Search

Categories

Links

Referers

Javac performance problems?

Mar 11 2005, 08:10:00 PM PST »Java»Compiler
If you want javac to run faster, here are a few options you might want to try:

-J-client Select the "client" VM aka HotSpot c1 compiler (that is, bytecode-to-native compiler, not a Java compiler). The server compiler's more aggressive approach to compilation is not beneficial for javac, see bug 5023037.

-J-XmsNNNm -J-XmxMMMm Use more memory :-) This will reduce the amount of time spent on collecting garbage (reclaiming unused memory). You need to be careful about this: if you specify too high a number the program will be paging and that will hurt performance. Let's say you have 512Mb RAM, then you should be able to see better javac performance by using this combination: -J-Xms100m -J-Xmx100m. Also you might want to experiment with -J-XX:NewSize=NNNm, for example: -J-XX:NewSize=30m. This number should be a fraction of the total heap size.

-g:none This will not generate debug information which will reduce the size of the class files and thus javac will be able to write them faster to disk. But I can't really recommend not having debugging information enabled.

-classpath Only list the jar files and directories you need for your compilation. The longer the class path, the more files javac will have to read even to compile the smallest program.

In addition to all these advices, I'm soon integrating some changes to Mustang to reduce compile time (and expect to backport it to Tiger). Please see bug 6186747.

Post a Comment:
Comments are closed for this entry.
Comments:

Java is a trademark of Sun Microsystems, Inc.
Copyright © 2006,2007 Peter von der Ahé