Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I guess JIT is the reason.</p> <p>Almost all kinds of JVM will do JIT when you run the program, but it has its own condition to start JIT. Given that the JDK you use is Oracle JDK. There're two modes you can select to run your JVM, client and server, and the conditions to start JIT in the two modes are different.I guess the mode you select is server.</p> <p>Depending on two counters, Invocation Counter and Back Edge Counter, JIT will compile you java bytecode to native code, which can improve your application performance.</p> <p><b>Invocation Counter</b> will count the invocation times of methods. When it's greater than some value, JIT start to compile the "hot" method to native code and replace the old code. Next time when you invoke the method, the program will run the native code.</p> <p><b>Back Edge Counter</b> will count the times in a loop. When it's greate than some value, JIT will compile the code in that loop to native and replace the old code. Because the replacement is on the invocation stack, it's also called <b>OSR(On Stack Replacement)</b>.</p> <p>You can control the Invocation Counter's "some value" by JVM parameter -XX:CompileThreshold=10000. That means after 10000 times invocation, the method will be compiled, and 10000 is the default value in the server mode.</p> <p>You can control the Back Edge Counter's "some value" by JVM parameter -XX: OnStackReplacePercentage=140. There's a formula here. "some value"=(CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage))/100. By default, InterpreterProfilePercentage=33 and OnStackReplacePercentage=140 in the server mode. Thar is, if the running time in the loop is beyond 10700, JIT will start.</p> <p>In general, I think the invocation time in step 2 triggers the JIT, so step 2 has higher performance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload