Sunday, 15 May 2011

performance - What is the overhead of a method call in a good Java VM? -


Can a decomposed machine code come with an assembler listing?

I mean that some upper part should be in C compared to the normal function call.

VM needs to track calls to find hotspots, and when it uses the compiled code, it needs to provide ways to change the compiled method to fly, Edit a new loaded class

: I think I should tell that I am a compiler writer and not a Java programmer and want to. Find out that Java applications are so slow that when Java micro benchmarks compare to native compiled code. So seeing some people is important to me, even if they only take a few dozen nanoseconds and some additional instructions.

Java does not compile directly into the machine code, it is compiled for bytecoc, which is then runtime But the machine code is either understood or compiled - I do not know how to reach the machine code at runtime, I just imagine that this large scale transfer, changing the bytes, to execute drum quickly and easily ends.

A small method should be compiled entirely on call runtime. Even a large method call can be written by VM in the form of in-line machine code if sufficient references can be solved or ignored.

The last use can be very helpful because this VM indicates how it can be.

Since a method call can actually be compiled completely and the best There is also a low cost on the price - you should not worry about it. Just worry about your best code and performance problems when you have failed performance specs (at which point Spot-Optimizing would be better than trying to end method calls in your code, waste your codebase for everyone involved in it ).

Note that due to runtime analysis, it can actually be faster than in the same case in C in some very rare cases (C compiler will not profile runtime and will have to adapt your code You must do all this, yourself).


No comments:

Post a Comment