runtime - Unable to understand a statement about compilers' optimization -


I have interest in customization from time to time by VM and compile-time. I have come to the idea that optimization is the most efficient and easiest in compile time.

However, in some cases my opinion seems to be false. This is evident in

[O] ptimization when performing in a sequential virtual machine is often easy - -.

Why is optimization easier when compared to compile time performed by a VM in order?

itemprop = "text">

Short answer: Because the Runtime recognizes hotspots and It's easy to analyze - some parts of your program are being used most of the time.

Long answer:

If you start running code in interpretation mode, then a virtual machine is confident that how often and when different parts of the code These parts can be used to better be optimized.

Take the nested if-then-other-clouse. Less Boolean checks require less runtime If you are optimizing the path for the part, that is executed more often, you can get a better overall order.

There is another issue, which you can do during the runtime, assumptions that are impossible at compile time. For example, Java-VM is inline in server-mode virtual methods - as long as only one class loads, which implements these methods. It will be unsafe, if time is done in compiling, if another class gets loaded, then JVM has repeated the code, but it is never too late.

Also on the runtime, more about the machine is known, the program is running. If you have a machine with more registers then you can use them. Again, this compilation is not secure at the time.

One thing to say: There are also disadvantages of adaptation at runtime. Most important: Time has been added for optimization in the runtime of the program. Apart from this, it is more complex because you have to compile parts of the program and execute them. Worms in the virtual machine are important. Think of a compiler, which sometimes crashes - you can compile again and everything is fine. If a VM sometimes crashes, it means that your program is sometimes crashing, not good.

As a conclusion: You can make every adaptation on the runtime, it is possible at the compile time ... and some other you have more information about the program, this is the execution path and Machine which is running the program. But you must be the factor in the time required to run optimization. Apart from this, the runtime is too complicated to do so and the compilations are more relevant than the time.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -