vhardy 2003/07/04 08:21:07
Modified: test-sources/org/apache/batik/test PerformanceTest.java
test-resources/org/apache/batik/test unitTesting.xml
Log:
Improved performance testing
Revision Changes Path
1.3 +23 -15
xml-batik/test-sources/org/apache/batik/test/PerformanceTest.java
Index: PerformanceTest.java
===================================================================
RCS file:
/home/cvs/xml-batik/test-sources/org/apache/batik/test/PerformanceTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PerformanceTest.java 4 Jul 2003 08:48:27 -0000 1.2
+++ PerformanceTest.java 4 Jul 2003 15:21:06 -0000 1.3
@@ -94,8 +94,8 @@
double refUnit = 0;
long refStart = 0;
long refEnd = 0;
- long opStart = 0;
long opEnd = 0;
+ long opStart = 0;
double opLength = 0;
// Run once to remove class load time from timing.
@@ -106,20 +106,32 @@
double[] scores = new double[iter];
for (int i=0; i<iter; i++) {
- refStart = System.currentTimeMillis();
- runRef();
- refEnd = System.currentTimeMillis();
- refUnit = refEnd - refStart;
-
- opStart = System.currentTimeMillis();
- runOp();
- opEnd = System.currentTimeMillis();
- opLength = opEnd - opStart;
+ if ( i%2 == 0) {
+ refStart = System.currentTimeMillis();
+ runRef();
+ refEnd = System.currentTimeMillis();
+ runOp();
+ opEnd = System.currentTimeMillis();
+ refUnit = refEnd - refStart;
+ opLength = opEnd - refEnd;
+ } else {
+ opStart = System.currentTimeMillis();
+ runOp();
+ opEnd = System.currentTimeMillis();
+ runRef();
+ refEnd = System.currentTimeMillis();
+ refUnit = refEnd - opEnd;
+ opLength = opEnd - opStart;
+ }
scores[i] = opLength / refUnit;
+ System.err.println(".");
+ // System.err.println(">>>>>>>> scores[" + i + "] = " + scores[i] + "
(" + refUnit + " / " + opLength + ")");
System.gc();
}
+ System.err.println();
+
// Now, sort the scores
sort(scores);
@@ -135,10 +147,6 @@
// Compute the score
this.lastScore = score;
-
- if (referenceScore != -1) {
- System.err.println(">>>>>>>>>>>>>>> score/lastScore : " +
score/referenceScore);
- }
// Compare to the reference score
if (referenceScore == -1) {
1.9 +6 -1 xml-batik/test-resources/org/apache/batik/test/unitTesting.xml
Index: unitTesting.xml
===================================================================
RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/unitTesting.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- unitTesting.xml 3 Jul 2003 14:51:08 -0000 1.8
+++ unitTesting.xml 4 Jul 2003 15:21:07 -0000 1.9
@@ -50,6 +50,11 @@
<!-- ==========================================================================
-->
<test id="PerformanceTestValidator"
class="org.apache.batik.test.PerformanceTestValidator" />
+ <!-- In the OnePerformanceTest, runOp is the same as runref. Therefore, the -->
+ <!-- score should be 1. -->
+ <test id="PerformanceTestSanity"
class="org.apache.batik.test.OnePerformanceTest">
+ <property name="ReferenceScore" class="java.lang.Double" value="1" />
+ </test>
</testSuite>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]