|
|
Learning goals of this exercise
In this exercise you will learn:
Background for this exercise
Please see Exercise 1 for an overview of running
the javaperf GUI launcher.
If you are running this lab on a workstation the Java 5.0 JVM
would probably choose the client compiler by default.
As of Java 5.0 there are more elaborate heuristics on choosing
default compiler and heap settings as described in the
Ergonomics in the 5.0 Java Virtual Machine document.
To avoid any guesswork we deliberately set the client
compiler in Exercise 9.
The client JIT compiler is very quick to
startup and is optimal for GUI applications. The server compiler
produces somewhat more optimal code (at the expense of longer startup
time). For server type workloads the server compiler will likely
provide better performance.
Steps to follow
compiler=-server
|
. You will see the Java 2D Demo application start.... Immediately click on the "Transforms" tab.
Then click into the "Shear" area so it fills the entire window.![[Stop]](Stop.png)
Summary
When should you use the
client compiler vs. the server compiler? This really depends on
your application. If fast startup is important then the client
compiler is certainly what you need. However, some very intense,
long-running GUI applications may benefit from -server. In the same way some server applications may have better performance with -client.
If footprint is an important criterion for performance then -client
will be better as that generated code is often more compact.
Measuring application "output" is going to be a better indication of
which compiler is best (rather than the time spent in GC).
Note that in this example we had only about 55 compiles.
The benefit of Ergonomics in Java 5.0 is that the JVM usually
chooses the correct compiler setting without you having
to do anything!
Next Steps
This lab documentation is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.