Patch: Minor object serialization optimization

Anthony Green green@redhat.com
Sat Sep 7 13:43:00 GMT 2002


The overhead of the debugging support in ObjectInputStream seems excessive (from
visual inspection at least :-). 
Here's one of the obvious offenders.  I think we should consider wrapping
all calls to dumpElementln with Configuration.DEBUG && dump checks.

Ok?


2002-09-07  Anthony Green  <green@redhat.com>

	* java/io/ObjectInputStream.java (readObject): Minor optimization.


Index: libjava/java/io/ObjectInputStream.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/ObjectInputStream.java,v
retrieving revision 1.12
diff -2 -c -p -r1.12 ObjectInputStream.java
*** libjava/java/io/ObjectInputStream.java	24 Jul 2002 16:05:34 -0000	1.12
--- libjava/java/io/ObjectInputStream.java	7 Sep 2002 20:34:47 -0000
*************** public class ObjectInputStream extends I
*** 244,249 ****
  	int handle = assignNewHandle (array);
  	readArrayElements (array, componentType);
! 	for (int i=0, len=Array.getLength(array); i < len; i++)
! 	  dumpElementln ("  ELEMENT[" + i + "]=" + Array.get(array, i));
  	ret_val = processResolution (array, handle);
  	break;
--- 244,252 ----
  	int handle = assignNewHandle (array);
  	readArrayElements (array, componentType);
! 	if (Configuration.DEBUG && dump)
! 	  {
! 	    for (int i=0, len=Array.getLength(array); i < len; i++)
! 	      dumpElementln ("  ELEMENT[" + i + "]=" + Array.get(array, i));
! 	  }
  	ret_val = processResolution (array, handle);
  	break;





More information about the Java-patches mailing list