Is the first request to a Java Application always slow even with JIT Compiler? -


i have confusion compilation , interpretation , way jit works. know source code or java program gets compiled java byte code loaded onto jvm either interprets bytecode native machine code or uses jit.

i going through interpreter doc , understood interpreter analyses each statement on every request , converts native code leading slower performance.

and read jit dynamic translation , stores native code on cache used subsequent requests.

what wanted understand how jit works? whenever first request made application converts part of byte code machine code, stores on cache , uses it.. process? if then, every first request slower needs translation of bytecode machine code?

please explain in detail.

depends on implementation, @ least in java, jit done "hotspots", i.e. used code. if jvm finds out method has been called more x times compile native code. meaning, have call few times first, , gets faster after that.

also, jit results kept in-memory, not saved disk, process starts scratch next time application runs (that big difference between just-in-time , ahead-of-time compilation, latter happening before program runs).

understood interpreter analyses each statement on every request , converts native code leading slower performance.

well, take performance hit waiting compilation happen once. after executing compiled native code method, , before interpreting bytecode. if jvm's guess method being hotspot right, should pay off on time.

is first request java application slow jit compiler?

if anything, presence of jit compiler makes first (or couple of early) requests slower, because adds work. however, subsequent requests should faster non-jit execution environment.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -