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

"-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

 Downloading and Installing JDK 1.8.0 on Windows

 Downloading and Installing JDK 1.7.0 on Windows

 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 28.2.7 by Oracle Corporation

 JVM Runtime Data Areas

 Memory Management and Garbage Collectors

 Garbage Collection Tests

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

 CPU Impact of Multi-Thread Applications

 I/O Impact of Multi-Thread Applications

 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

 Outdated Tutorials

 References

 PDF Printing Version

"-Xint" - Running in Interpreted-Only Mode - Updated in 2014, by Dr. Herong Yang