IS there a way to turn off JIT compiler and is there a performance impact by doing so?

那年仲夏 提交于 2019-12-01 01:10:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!