"AL" == Anders Lindback <[EMAIL PROTECTED]> writes:

  AL> Barnet Wagman skrev:
  >> 
  >> By default, the Java compilers includes line numbers in the bytecode 
  >> they produce.  Is there much benefit to compiling production code 
  >> without line numbers (-o option, I believe), in terms of speed?

  AL> Removing the line number and other debugging info makes the 
  AL> compiled byte code smaller and with a smaller memory footprint
  AL> an application may run faster. But only if you have a performance
  AL> problem where applicaitons are using too much memory.
  AL> (Performance problems usually are one of CPU speed, memory or I/O.)

  AL> In theory using the -O optimizer option should make the
  AL> code faster - but it all depends on the application
  AL> if you see any big change. 

I thought that line numbers were kept in the attribute section of the
classfile, and that the bytecodes were identical. Is this not correct?

Also, there is no documented -O option with Sun's 1.4.0 Java compiler
(Search for "-O" on the javac documentation page,
http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/javac.html) although
it is accepted and the command "javac -help" lists it. Compiling a
409 line Java source file produced no difference in bytecode between the
"optimized" compile and the non-optimized compile.

I believe that the rationale for removing the -O functionality is that
mixed-mode interpreters like HotSpot do a much better job of
(on-the-fly) optimization than static, compile-time optimizers can do.

--- Vladimir

--------
Vladimir G. Ivanovic                        http://leonora.org/~vladimir
2770 Cowper St.                                         [EMAIL PROTECTED]
Palo Alto, CA 94306-2447                                 +1 650 678 8014








  AL> ----------------------------------------------------------------------
  AL> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
  AL> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to