Reputation: 21924
I have a Maven profile for a Java project that is activated when doing a final build on a Hudson CI server.
Currently this profile's only customization is to the Maven compiler plugin as follows:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>false</debug>
<optimize>true</optimize>
</configuration>
</plugin>
Are there any other tweaks or optimizations to the Java compiler that a final build should be doing to maximize performance?
Upvotes: 11
Views: 9055
Reputation: 11
For our maven based build I do not use <debug>false</debug>
instead I'm setting the debug options with <debuglevel/>
which allows a much more finer control {see javac option -g
}.
Upvotes: 1
Reputation: 2674
Assuming that you're running on the Sun (Hotspot) JVM, all optimization happens in the JVM.
So specifying <optimize>true</optimize>
does nothing.
And specifying <debug>false</debug>
simply removes debugging symbols. Which will slightly decrease your JARfile size, but make it much harder to track down production problems, because you won't have line numbers in your stack traces.
One thing that I would specify is JVM compatibility settings:
<source>1.6</source>
<target>1.6</target>
Upvotes: 18
Reputation: 1500475
You shouldn't even do that - optimization in javac
has been disabled for quite a while, IIRC. Basically the JIT is responsible for almost all the optimization, and the javac optimizations actually hurt that in some cases.
If you're looking to tune performance you should look elsewhere:
Upvotes: 11