Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As you've seen, the JIT can skew test results, since it runs in a background thread, stealing cpu cycles from your main thread running the test.</p> <p>As well as stealing cycles, it's also asynchornos, so you cannot be sure it has finished it's work when you complete warmup and start your test for real. To force synchronous JIT compilation, You can use the <code>-XBatch</code> nonstandard option to force JIT compilation to the foreground thread, so you can be sure the JIT has finished when your warmup completes.</p> <p>HotSpot doesn't compile methods right away, but waits until a method has been executed a certain number of times. On the <a href="http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp" rel="noreferrer">page</a> for the -XX options, it states that the default for -server is 10000 times, while for -client it is 1500 times. This could be a cause of the slowdown, particularly if your warmup ends up invoking many critical methods between 1500 and 10000 times: with the <code>-client</code> option they will be JITed during the warmup phase, but running with -server, compilation may be delayed execution of your profiled code.</p> <p>You can change the number of method invocations needed before HotSpot compiles a method by setting <code>-XX:CompileThreshold</code>. I choose twenty so that even vaguely hot-spots (luke-warm spots?) are converted during the warmup even when the test is run just a few times. This has worked for me in the past, but YMMV and different values may give you better results.</p> <p>You might also check the HotSpot VM Options page to find the other options that differ between -client and -server options, particularly the garbage collector options, as these differ considerably.</p> <p>See</p> <ul> <li><a href="http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp" rel="noreferrer">Java HotSpot VM Options</a></li> </ul>
 

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