previous | start | next

Timing

Java uses Just-In-Time compiling to translate "frequently" executed byte code to native machine code.

If a program uses the doubling experiment to execute the same code for input size N and repeat for size 2N, it could run faster for the larger size because of just-in-time translation.

To turn off just-in-time compiling (jit) the following option can be passed to the java virtual machine (jvm), that is, to the java program.

 -Djava.compiler=none      
   

In Eclipse, you can do this for all projects:

  Windows > Preferences > Java > Installed JREs      
   

Select the Java Run Time Environment (probably only one) and select Edit

In the box for Default VM arguments enter the option:

 -Djava.compiler=none      
   

To turn jit back on, just repeat the steps above and delete this option.



previous | start | next