4 ms·
Because the jit will let the unoptimized code run a few (hundred) times to take measurements to know what needs to be optimized and how it needs to be optimized
by hunterpayne 11mo ago
Because the jit will let the unoptimized code run a few (hundred) times to take measurements to know what needs to be optimized and how it needs to be optimized. This is a good solution and makes hotspot very effective. The problem is that it happens randomly a few minutes/seconds into the operation of the service. So you randomly have a big pause with the performance hit everytime you run the service. The upside is that this only happens once. But you have to plan for a big performance hit to requests which are unlucky enough to be called at the wrong time.
- pretzellogician 11mo agoAnd this can generally be avoided as well, by doing "warmup" when starting your service (effectively, mock some calls), but before accepting requests.
- hunterpayne 11mo agoOf course, but then you have to actually do this. It is just another complexity to add. Also, I was answering a question about the hows and whys of the jit. I wasn't saying it was impossible to work around.
- munchler 11mo agoAh, that’s interesting. I wasn’t aware that JIT-ing will do that sort of performance analysis first. Thank you for the explanation.
- still_grokking 11mo agoIt won't in general. Doing so is a feature of high-end VM runtimes like the state of the art JVMs or JS runtimes.