ObjectIn/OutputStream improvements
Chris Hegarty
chris.hegarty at oracle.com
Tue Jan 7 09:05:54 UTC 2014
On 15 Dec 2013, at 10:29, Robert Stupp <snazy at gmx.de> wrote:
> Hi,
>
> I digged through the object serialization code and found some lines that could be optimized to reduce the number of calls to System.arraycopy() and temporary object allocations especially during string (de)serialization.
> In short sentences the changes are:
> ObjectInputStream:
> - skip primitive/object reading if no primitive/objects in class (defaultReadFields method)
> - use shared StringBuilder for string reading (prevent superfluous object allocations of one StingBuilder and one implicit char[] for each string being deserialized)
> ObjectOutputStream:
> - skip primitive/object writing if no primitive/objects in class (defaultWriteFields method)
> - use unsafe access to calculate UTF-length
> - use unsafe access in readBytes() and writeChars() methods to access String value field
> - removed cbuf field
> ObjectStreamClass/ObjectStreamField:
> - minor improvement in getClassSignature ; share method code with ObjectStreamField (return constant string for primitives)
>
> I have tested the changes in a big Java installation at a customer (backported the Java8 ObjectIn/OutputStream including the changes to Java6) and a long running real application performance test resulted in reduced CPU usage (from about 60% per server to 50%).
> The changes I made in openjdk8 pass all tests.
>
> Since I have no experience how to contribute code to openjdk in form of a push/changeset I have added the diff (hg export -g) to this email.
Did you attach the diffs? I don’t see any attachment, it may be that the attachment was stripped. Can you try resending inline?
You should take a look at the OpenJDK How to Contribute page [1]. Paying particular attention to the OCA, without it we will not be able to move your patch forward.
Thanks,
-Chris.
[1] http://openjdk.java.net/contribute/
>
> Robert
>
>
More information about the core-libs-dev
mailing list