Tuning Java 7 to match performance of Java 6 -


we have simple unit test part of our performance test suite use verify base system sane , performs before start testing our code. way verify machine suitable running actual performance tests.

when compare java 6 , java 7 using test, java 7 takes considerably longer execute! see average of 22 seconds java 6 , 24 seconds java 7. test computes fibonacci, bytecode execution in single thread should relevant here , not i/o or else.

currently run default settings on windows or without "-server", both 32 , 64 bit jvm, runs indicate similar degradation java 7.

which tuning options may suitable here try match java 7 against java 6?

public class baselineperformance {      @before     public void setup() throws exception{         fib(46);     }      @test     public void testbaseline() throws exception {         long start = system.currenttimemillis();         fib(46);         fib(46);         system.out.println("time: " + (system.currenttimemillis() - start));     }      public static void fib(final int n) throws exception {         (int = 0; < n; i++) {             system.out.println("fib(" + + ") = " + fib2(i));         }     }      public static int fib2(final int n) {         if (n == 0)             return 0;         else if (n == 1)             return 1;         else             return fib2(n - 2) + fib2(n - 1);     } } 

update: have reduced test not sleeps , followed other suggestions how write correct micro-benchmark in java?, still see same difference between java 7 , java 6, additional jvm options print compilation , gc not show output during actual test, compilation information printed.

one of colleagues found out reason after bit more digging:

there jvm flag -xx:maxrecursiveinlinelevel has default value of 1. seems handling of setting incorrect in previous versions, sun/oracle "fixed" in java 7, has side-effect inlining done less aggressively , pure runtime/cpu time of recursive code can longer before.

we testing setting 2 same behavior in java 6 @ least test in question.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -