aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-04-26 02:39:48 +0200
committerSven Göthel <[email protected]>2024-04-26 02:39:48 +0200
commit48717894eddfe6111364416aa7755f7369f09ed6 (patch)
treefd33d64affc0217dd24880117f0592c73eccac5d /src
parent59420652c96956c7d9d4e501200ddbe91edc1c34 (diff)
Math: Align mul + inv perf tests with native jaulibHEADmaster
Diffstat (limited to 'src')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f02MulNOUI.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f03InversionNOUI.java90
2 files changed, 46 insertions, 60 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f02MulNOUI.java b/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f02MulNOUI.java
index 090dcf6e7..1805bec7e 100644
--- a/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f02MulNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f02MulNOUI.java
@@ -188,16 +188,16 @@ public class TestMatrix4f02MulNOUI extends JunitTracer {
// warm-up
for(int i=0; i<warmups; i++) {
res_n.mul(n1, n2);
- dr += res_m.determinant();
+ dr += res_n.determinant();
res_n.mul(n2, n1);
- dr += res_m.determinant();
+ dr += res_n.determinant();
}
t_0 = Platform.currentTimeMillis();
for(int i=0; i<loops; i++) {
res_n.mul(n1, n2);
- dr += res_m.determinant();
+ dr += res_n.determinant();
res_n.mul(n2, n1);
- dr += res_m.determinant();
+ dr += res_n.determinant();
}
tI5a = Platform.currentTimeMillis() - t_0;
Assert.assertTrue( dr > 0 );
@@ -206,19 +206,19 @@ public class TestMatrix4f02MulNOUI extends JunitTracer {
for(int i=0; i<warmups; i++) {
res_n.load(n1);
res_n.mul(n2);
- dr += res_m.determinant();
+ dr += res_n.determinant();
res_n.load(n2);
res_n.mul(n1);
- dr += res_m.determinant();
+ dr += res_n.determinant();
}
t_0 = Platform.currentTimeMillis();
for(int i=0; i<loops; i++) {
res_n.load(n1);
res_n.mul(n2);
- dr += res_m.determinant();
+ dr += res_n.determinant();
res_n.load(n2);
res_n.mul(n1);
- dr += res_m.determinant();
+ dr += res_n.determinant();
}
tI5b = Platform.currentTimeMillis() - t_0;
Assert.assertTrue( dr > 0 );
diff --git a/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f03InversionNOUI.java b/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f03InversionNOUI.java
index ae0d8d739..9bbe778a0 100644
--- a/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f03InversionNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/math/TestMatrix4f03InversionNOUI.java
@@ -262,6 +262,9 @@ public class TestMatrix4f03InversionNOUI extends JunitTracer {
}
tI2 = Platform.currentTimeMillis() - t_0;
+ // avoid optimizing out unused computation results by simply adding up determinat
+ double dr = 1;
+
//
// Matrix4f
//
@@ -269,42 +272,34 @@ public class TestMatrix4f03InversionNOUI extends JunitTracer {
// warm-up
for(int i=0; i<warmups; i++) {
res_m.invert(p1_m);
+ dr += res_m.determinant();
res_m.invert(p2_m);
+ dr += res_m.determinant();
}
t_0 = Platform.currentTimeMillis();
for(int i=0; i<loops; i++) {
res_m.invert(p1_m);
+ dr += res_m.determinant();
res_m.invert(p2_m);
+ dr += res_m.determinant();
}
tI4a = Platform.currentTimeMillis() - t_0;
- if( false ) {
- // warm-up
- for(int i=0; i<warmups; i++) {
- res_m.load(p1_m).invert();
- res_m.load(p2_m).invert();
- }
- t_0 = Platform.currentTimeMillis();
- for(int i=0; i<loops; i++) {
- res_m.load(p1_m).invert();
- res_m.load(p2_m).invert();
- }
- tI4b = Platform.currentTimeMillis() - t_0;
- } else {
- res_m.load(p1_m);
-
- // warm-up
- for(int i=0; i<warmups; i++) {
- res_m.invert();
- res_m.invert();
- }
- t_0 = Platform.currentTimeMillis();
- for(int i=0; i<loops; i++) {
- res_m.invert();
- res_m.invert();
- }
- tI4b = Platform.currentTimeMillis() - t_0;
+ // warm-up
+ for(int i=0; i<warmups; i++) {
+ res_m.load(p1_m).invert();
+ dr += res_m.determinant();
+ res_m.load(p2_m).invert();
+ dr += res_m.determinant();
+ }
+ t_0 = Platform.currentTimeMillis();
+ for(int i=0; i<loops; i++) {
+ res_m.load(p1_m).invert();
+ dr += res_m.determinant();
+ res_m.load(p2_m).invert();
+ dr += res_m.determinant();
}
+ tI4b = Platform.currentTimeMillis() - t_0;
//
// Matrix4fb
@@ -313,43 +308,34 @@ public class TestMatrix4f03InversionNOUI extends JunitTracer {
// warm-up
for(int i=0; i<warmups; i++) {
res_n.invert(p1_n);
+ dr += res_n.determinant();
res_n.invert(p2_n);
+ dr += res_n.determinant();
}
t_0 = Platform.currentTimeMillis();
for(int i=0; i<loops; i++) {
res_n.invert(p1_n);
+ dr += res_n.determinant();
res_n.invert(p2_n);
+ dr += res_n.determinant();
}
tI5a = Platform.currentTimeMillis() - t_0;
- if( false ) {
- // warm-up
- for(int i=0; i<warmups; i++) {
- res_n.load(p1_n).invert();
- res_n.load(p2_n).invert();
- }
- t_0 = Platform.currentTimeMillis();
- for(int i=0; i<loops; i++) {
- res_n.load(p1_n).invert();
- res_n.load(p2_n).invert();
- }
- tI5b = Platform.currentTimeMillis() - t_0;
- } else {
- res_n.load(p1_n);
-
- // warm-up
- for(int i=0; i<warmups; i++) {
- res_n.invert();
- res_n.invert();
- }
- t_0 = Platform.currentTimeMillis();
- for(int i=0; i<loops; i++) {
- res_n.invert();
- res_n.invert();
- }
- tI5b = Platform.currentTimeMillis() - t_0;
+ // warm-up
+ for(int i=0; i<warmups; i++) {
+ res_n.load(p1_n).invert();
+ res_n.load(p2_n).invert();
+ }
+ t_0 = Platform.currentTimeMillis();
+ for(int i=0; i<loops; i++) {
+ res_n.load(p1_n).invert();
+ dr += res_n.determinant();
+ res_n.load(p2_n).invert();
+ dr += res_n.determinant();
}
+ tI5b = Platform.currentTimeMillis() - t_0;
+ System.err.printf("Checkmark %f%n", dr);
System.err.printf("Summary loops %6d: I0 %6d ms total, %f us/inv%n", loops, tI0, tI0*1e3/loops);
System.err.printf("Summary loops %6d: I2 %6d ms total, %f us/inv, I2 / I0 %f%%%n", loops, tI2, tI2*1e3/2.0/loops, tI2/(double)tI0*100.0);
System.err.printf("Summary loops %6d: I4a %6d ms total, %f us/inv, I4a / I2 %f%%%n", loops, tI4a, tI4a*1e3/2.0/loops, (double)tI4a/(double)tI2*100.0);