I found another location in OOS code that might be an optimization point:
In java.io.ObjectOutputStream.BlockDataOutputStream#write(byte[], int, int, 
boolean) the first lines look like this:
            if (!(copy || blkmode)) {           // write directly
                drain();
                out.write(b, off, len);
                return;
            }
The block is executed a lot and prevents effective buffering in the internal 
"byte[] buf" field. I've replaced it with
            if (!(copy || blkmode)) {           // write directly
                if (len + pos <= MAX_BLOCK_SIZE) {
                    System.arraycopy(b, off, buf, pos, len);
                    pos += len;
                }
                else {
                    drain();
                    out.write(b, off, len);
                }
                return;
            }
and it works - at least for our application. I've no idea what that "if" was 
originally for.

Another point of optimization would be to either introduce "readResolve()" in 
primitive wrapper classes (Boolean, Byte, Character, Short, Integer, Long) or 
add some support to handle primitive wrapper classes in 
java.io.ObjectInputStream#readOrdinaryObject. The current implementation 
creates new (senseless?) instances of these wrapper classes. This changes 
deserialization semantics (no distinct object references for those classes) - 
maybe it should be delayed to "serialization 2.0"?

-Robert

Am 07.01.2014 um 10:05 schrieb Chris Hegarty <chris.hega...@oracle.com>:

> Did you attach the diffs? I don’t see any attachment, it may be that the 
> attachment was stripped. Can you try resending inline?

Reply via email to