Skip to main content

-Xcomp JVM option considered dangerous?

1 reply [Last post]
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
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"

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
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.
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