Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hotspot JIT optimization and "de-optimization": how to force FASTEST?

I have a BIG application that I'm trying to optimize. to do so, I'm profiling / benchmarking small elements of it by running them millions of times in a loop, and checking their processing time.

obviously Hotspot's JIT is kicking in, and I can actually see when that happens. I like it, I can clearly see things going much faster after the "warm up" period.

however, after reaching the fastest execution speed and keeping it for some time, I can see that the speed is then reduced to a less impressive one, and it stays there.

what's executed in the loop does not actually change much, so I can hardly see why escape analysis would force a "de-optimization" of code.

basically I get the feeling the JIT is getting the best performance, then settles for something slower, thinking that it's "enough".

is there any way to tell him "it's not enough, I really want that code to run as fast as possible !". I know it can as it already did. Just how can I force it to do so ?

like image 448
Bastien Avatar asked Nov 29 '25 15:11

Bastien


1 Answers

Its impossible to trace with a "product" (read normal released) build, I would put the code through yourkit and see what's happening, hotspot will try to get the best possible optimisation at all times.

It will only go slower if you have code that forces de-optimisation in the jit, in the profiler you should be able to see this as things like large numbers of allocations, huge number of exceptions.

like image 102
Greg Bowyer Avatar answered Dec 01 '25 05:12

Greg Bowyer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!