Skip to main content

-Xcomp JVM option considered dangerous?

1 reply [Last post]
doubletrouble
Offline
Joined: 2007-11-15

Does anyone know what the story with this option is?

First, it's listed on the "official" webpage of "unofficial" JVM options
http://blogs.sun.com/watt/resource/jvm-options-list.html
Altho, unlike -Xint, it does not appear (at least for JDK 1.6.0_05) when I execute
java -X

Second, is it a bad choice for performance?

I found anecdotal reports of it causing worse performance:
"And using option -Xcomp (which means that all code is compiled before usage) gives even lower performance, which is surprising"
http://www.ics.muni.cz/~makub/java/speed.html

The only way that I can see it causing worse performance is if the initially compiled code is the ONLY compilation that is ever done. In this case, with no profiling information to guide the compilation, suboptimal code should be generated. The 2nd response here
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=652276
indicates that this is the case.

But in theory, the first use of the code could be a quick compilation which also has profiling code inside and which gets recompiled more optimally in the future.

Anyone know what is really going on inside the HotSpot JVM?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
linuxhippy
Offline
Joined: 2004-01-07

-Xcomp is often not really adviseable, because, as you mentioned, no profiling is done when the code is compiled.

What you want (quick compilation first, heavy optimizations later) is tiered compilation, which is in the latest JDK7 builds. A method is first compiled using the client-compiler with profiling enabled.
I would suggest adopting the compilation-thresholds to 1000/35000, because the default values are not really good.

lg Clemens