JVM Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 4.10

Performance Improvements of JIT Compilation

This section provides a performance comparison between interpreted-only mode and JIT compilation mode on loops with different operations. The JIT compiler improves performance a lot!

If you compare testing results between interpreted-only mode and JIT compilation mode, you will see performance improvements produced by the JIT compiler.

This table provides execution time of different "int" loops per step in nanoseconds:

                        int         int
                Interpreted         JIT
                       Only Compilation
Empty loop               16           1
Assignment: x=i          14           2
Shift: x=i<<1            17           1
Add: x=i+i               17           1
Multipply: x=i*3         17           1
Divide: x=i/3            19          14 

This table provides execution time of different "long" loops per step in nanoseconds:

                       long        long
                Interpreted         JIT
                       Only Compilation
Empty loop               25           2
Assignment: x=i          24           3
Shift: x=i<<1            30           4
Add: x=i+i               34           3
Multipply: x=i*3         38           4
Divide: x=i/3            53          24 

Conclusion:

  • Do not turn off JIT compilation in your JVM!
  • Avoid using "long" operations!
  • Avoid using division operations!

Last update: 2010.

Table of Contents

 About This Book

 Download and Install Java SE 1.6 Update 2

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

 ClassLoader Class - Class Loaders

 Class Class - Class Reflections

 Sun's JVM - Java HotSpot VM

 JRockit JVM 7.0 by BEA Systems

 JRockit JVM 8.0 by BEA Systems

 Memory Management Rules and Tests

 Garbage Collection Tests

 Stack Overflow Tests

 Thread Testing Program and Result

 StringBuffer Testing Program and Result

 CDS (Class Data Sharing)

 Micro Benchmark Runner and JVM Options

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

Micro Benchmark Tests in JIT Compilation Mode

 "int" Loops with JIT Compilation

 "long" Loops with JIT Compilation

Performance Improvements of JIT Compilation

 Micro Benchmark Tests on "float" and "double" Operations

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2010
Performance Improvements of JIT Compilation