]> source.dussan.org Git - jgit.git/commitdiff
Wait for JIT optimization before measuring diff performance 49/1449/4
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 29 Aug 2010 21:41:10 +0000 (23:41 +0200)
committerChris Aniszczyk <caniszczyk@gmail.com>
Mon, 30 Aug 2010 20:56:52 +0000 (15:56 -0500)
On Mac OS X MyerDiffPerformanceTest was failing since during the
first few tests the JIT compiler is running in parallel slowing down
the tests. When setting the JVM option -Xbatch forcing the JIT to do
its work prior to running the code this effect can be avoided. Instead
we chose to run some tests without recording prior to the recorded
tests since relying on -X JVM parameters isn't portable across JVMs.

Use 10k * powers of 2 as sample size instead of odd numbers used
before and also improve formatting of performance readings.

Bug: 323766
Change-Id: I9a46d73f81a785f399d3cf5a90c8c0516526e048
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/MyersDiffPerformanceTest.java

index 37a9a4d6369820b8fb5e318bda95512ad7e0c60a..b97c1633f714425e678a06bc551978ea9e30b5aa 100644 (file)
@@ -100,7 +100,7 @@ public class MyersDiffPerformanceTest extends TestCase {
                        return ("diffing " + N / 2 + " bytes took " + runningTime
                                        + " ns. N=" + N + ", D=" + D + ", time/(N*D):"
                                        + fmt.format(perf1()) + ", time/(N*D^2):" + fmt
-                                       .format(perf2()));
+.format(perf2()) + "\n");
                }
        }
 
@@ -116,13 +116,21 @@ public class MyersDiffPerformanceTest extends TestCase {
 
        public void test() {
                if (stopwatch!=null) {
+                       // run some tests without recording to let JIT do its optimization
+                       test(10000);
+                       test(20000);
+                       test(10000);
+                       test(20000);
+
                        List<PerfData> perfData = new LinkedList<PerfData>();
                        perfData.add(test(10000));
                        perfData.add(test(20000));
-                       perfData.add(test(50000));
+                       perfData.add(test(40000));
                        perfData.add(test(80000));
-                       perfData.add(test(99999));
-                       perfData.add(test(999999));
+                       perfData.add(test(160000));
+                       perfData.add(test(320000));
+                       perfData.add(test(640000));
+                       perfData.add(test(1280000));
 
                        Comparator<PerfData> c = getComparator(1);
                        double factor = Collections.max(perfData, c).perf1()