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

herong> java -XX:+PrintGC -XX:+UseSerialGC -Xms100m -Xmx100m \
   -Xint -XX:+PrintCompilation \
   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:

Table of Contents

 About This Book

 JVM (Java Virtual Machine) Specification

 Java HotSpot VM - JVM by Oracle/Sun

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

 ClassLoader Class - Class Loaders

 Class Class - Class Reflections

 JVM Runtime Data Areas

 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

 OpenJ9 by Eclipse Foundation

 JRockit JVM 28.2.7 by Oracle Corporation

 Archived Tutorials

 References

 Full Version in PDF/EPUB