It seems unlikely that it would inline that code, and there would be no benefit to doing so.
-O
Directs the compiler to try to generate faster code by inlining static, final and private methods. This option may slow down compilation, make larger class files, and/or make it difficult to debug. -O implicitly turns on -depend and turns off -g.
This option informs the compiler that all generated class files are guaranteed to be delivered and upgraded as a unit, enabling optimizations that may otherwise break binary compatibility. Use this option with discretion.
The Java Language Specification section 13.4.21 describes situations in which it is legal to use a java compiler to inline methods. The compiler will only optimize code for which source is available during the compilation, so the only .java files discoverable by the compiler should be for classes intended to be delivered or upgraded as a unit. In particular, ensure that no sources for other classes are accessible on CLASSPATH, keeping in mind that the present working directory, `.', is appended to CLASSPATH.
To ensure that a product is able to run on 1.1 as well as future binary-compatible java virtual machines, one must ensure that any sources for JDK 1.1 classes are never available along CLASSPATH while using -O.
Tudor Raneti wrote:
It seems unlikely that it would inline that code, and there would be no benefit to doing so.
Pushing stuff on the stack takes extra CPU cycles.
Also, this code bit is checked almost on every other client request
, and, if there's 100 clients logged in at one time... it's 100 times the overhead if the code doesn't get inlined.
Tudor Raneti wrote:
It's possible to do at javac time, and I seen this HERE:
-O
Directs the compiler to try to generate faster code by inlining static, final and private methods. This option may slow down compilation, make larger class files, and/or make it difficult to debug. -O implicitly turns on -depend and turns off -g.
This option informs the compiler that all generated class files are guaranteed to be delivered and upgraded as a unit, enabling optimizations that may otherwise break binary compatibility. Use this option with discretion.
The Java Language Specification section 13.4.21 describes situations in which it is legal to use a java compiler to inline methods. The compiler will only optimize code for which source is available during the compilation, so the only .java files discoverable by the compiler should be for classes intended to be delivered or upgraded as a unit. In particular, ensure that no sources for other classes are accessible on CLASSPATH, keeping in mind that the present working directory, `.', is appended to CLASSPATH.
To ensure that a product is able to run on 1.1 as well as future binary-compatible java virtual machines, one must ensure that any sources for JDK 1.1 classes are never available along CLASSPATH while using -O.
Trying to tell if it did or did not ATM, perhaps observing class file length?
optimize Indicates whether source should be compiled with optimization; defaults to off. Note that this flag is just ignored by Sun's javac starting with JDK 1.3 (since compile-time optimization is unnecessary).
Tudor Raneti wrote:
It would seem that optimising this isn't really necessary
, still... it's only one final keyword
and I was mainly concerned if it does inline the code, which I can't tell and too lazy to make up an experiment ATM (isn't worth it)
Thanks for the help