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

"-Xint" - Running in Interpreted-Only Mode

This section provides a tutorial example on how to run benchmark tests in interpreted-only mode using the '-Xint' JVM option.

Another interesting performance test is see how fast the test code can run in interpreted-only mode. This can be archived by disabling the JIT compilation in the JVM so that all bytecodes will be executed by the interpreter.

To force the JVM to stay in interpreted-only mode, you need to use the "-Xint" option as shown in the following test:

C:\herong\jvm>java -Xint -XX:+PrintGC -XX:+PrintCompilation
   -Xms100m -Xmx100m
   BenchmarkRunner BenchmarkLoopTest emptyLoop 10000 3 3

Are you ready?
y

Waking up the JIT compiler...
Run: 1, Time: 6426, Test returns: 3
Run: 2, Time: 3632, Test returns: 3
Run: 3, Time: 3352, Test returns: 3
...
Run: 1065, Time: 3352, Test returns: 3
Run: 1066, Time: 3073, Test returns: 3
Run: 1067, Time: 3073, Test returns: 3
Run: 1068, Time: 2235, Test returns: 3
Run: 1069, Time: 2514, Test returns: 3
...
Run: 9995, Time: 2514, Test returns: 3
Run: 9996, Time: 2514, Test returns: 3
Run: 9997, Time: 2515, Test returns: 3
Run: 9998, Time: 2515, Test returns: 3
Run: 9999, Time: 2235, Test returns: 3
Run: 10000, Time: 2235, Test returns: 3
...

Conclusions based on the test result:

  • "-Xint" option is working. No JIT compilations happened.
  • The execution time in interpreted-only mode is about 2514 nanoseconds for the empty loop of 3 iterations.
  • The execution time in native code produced by the JIT compilation is about 1956 nanoseconds for the empty loop of 3 iterations based on previous tests.

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

 What Is Micro Benchmark?

 BenchmarkRunner.java - Benchmark Runner Program

 emptyLoop() - The Empty Loop Test Method

 "-XX:+PrintCompilation" - Watching JIT Compilation Logs

 "-XX:+PrintGC" - Watching GC (Garbage Collection) Logs

 "-Xms" and "-Xmx" - Avoiding GC with Large Memory Size

 Benchmark Affected by Other Running Applications

"-Xint" - Running in Interpreted-Only Mode

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

 Micro Benchmark Tests in JIT Compilation Mode

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

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2010
"-Xint" - Running in Interpreted-Only Mode