debug output problem in ObjectInputStream
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Wed Apr 3 01:23:00 GMT 2002
Per Bothner wrote:
> Having dumpElement[ln] as separate
> methods has the advantage that it could over overridden, but
> it seems like poinles generality. So if we want to keep the
> debugging printout, I suggest:
>> if (Configuration.DEBUG && dump)
> for (int i=0, len=Array.getLength(array); i < len; i++)
> System.out.println(" ELEMENT[" + i + "]=" + Array.get(array, i));
>> This makes it possible for a compiler to do the optimization to
> multiple print calls that my patch does.
I was originally hoping that the dumpElement() methods would get inlined
and the compiler would figure out that the code could be removed, but
you're right in that even if inlining worked properly the arguments
would still have to be evaluated unless it could also figure out that
the StringBuffer methods etc had no side-effects.
I agree that we should put the "if (Configuration.DEBUG ..." at the call
site to fix this. However, fixing this doesn't really help our extremely
crap serialization performance. eg the attached test runs more than 45X
slower with GCJ than JDK 1.4! Serialization needs some work...
regards
Bryce.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SerTest3.java
URL: <http://gcc.gnu.org/pipermail/java/attachments/20020403/512411d9/attachment.ksh>
More information about the Java
mailing list