问题
What does it mean for a java program to be JIT'ed and does it make the execution a lot more faster or are there bytecodes which are not JIT'ed?
回答1:
There is two ways to disable the JIT
-Djava.compiler=NONE
or this will almost never compile anything
-XX:CompileThreshold=2000000000
or on IBM JVM
-nojit
Disabling the JIT can slow down your code a lot e.g. 50x but not always. If you spend most of your time doing IO or GUI updates you might find it makes little difference.
回答2:
For IBM the correct option is -Xnojit or -Xint
回答3:
From the doc,
-Xint
Runs the application in interpreted-only mode. Compilation to native code is disabled, and all bytecode is executed by the interpreter.
The java.compiler
system property is known by Compiler class before Java 9. In Java 9 it's marked as @Deprecated
.
回答4:
In HotSpot VM JIT compilation can be disabled with the option -XX:-UseCompiler which skips compiler threads initialization.
It is true
by default:
product(bool, UseCompiler, true,
"Use Just-In-Time compilation")
来源:https://stackoverflow.com/questions/34315960/is-there-a-way-to-turn-off-jit-compiler-and-is-there-a-performance-impact-by-doi