I'm trying to do some benchmarking of JVMs running on various hardware and OS platforms. I've created an algorithm to exercise the parts of the JVM I'm interested in and intend to run this algorithm many times to find a decent average.
When I run the benchmark, I find that the first run is significantly longer than subsequent runs:
132ms
86ms
77ms
89ms
72ms
My suspicion is that classes are loaded lazily, putting a large overhead on the first run. While this is indeed a feature that I assume is unique to each JVM, it's not one I'm interested in at this point.
Is there a standard command line option or property to eagerly load classes? or does anyone have any other theories?
Use java -XX:+TraceClassLoading
to trace the loading of classes.
Use java -XX:+PrintCompilation
to trace when methods are JITed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With