Sunday, 7 September 2014


TierCompilation is a mix of client (C1) and server (C2) compilation. With tiered compilation, code is first compiled by the client compiler. When it becomes hot, it is recompiled by the server compiler.
The goal of the TierCompilation is to get best of both client (C1) and server (C2) compilers. Client compiler begins compiling sooner than the server compiler does. So client compiler is faster than the server in code execution. But client compiler provides less optimization and code quality is not as good as server generated one.
Though server compiler is slow, it provides better quality code. Server compiler waits to gain the knowledge about the code and uses the knowledge to optimize the code. It inlines much more aggressively. Code produced by the server compiler is faster than that produced by client compiler. TierCompilation takes the advantages of both client (fast startup) and server compiler (peak performance).
In Java 7, -XX:+TieredCompilation flag needs to be used to enable TierCompilation. Make sure you specify the server compiler with the -server flag or by ensuring it is the default for the particular Java installation being used. In Java 8, TierCompilation is enabled by default.

No comments:

Post a Comment