Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] More Serializer performance patches

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <whoschek AT lbl.gov>
  • To: Elliotte Harold <elharo AT metalab.unc.edu>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] More Serializer performance patches
  • Date: Thu, 21 Jul 2005 10:52:08 -0700

On Jul 21, 2005, at 9:30 AM, Elliotte Harold wrote:

Wolfgang Hoschek wrote:


2. replace BufferedWriter used by Serializer with an unsynchronized custom version, enabling much better compiler inlining


I've confirmed this. It's a noticeable improvement. A version of this is now in CVS. It's a bit of a surprise. I thought synchronization wasn't supposed to have such a huge impact in modern VMs.

I experimented with several variations but I ended up committing basically what Wolfgang submitted modulo some refinements to fit my coding conventions that I don't think have any impact on the byte code. I'll look at the other changes as time permits. Thanks!


You also want to want to declare "out" a non-polymorphic variable in TextWriter.

private final UnsynchronizedBufferedWriter out;

This greatly eases the inlining burden on the compiler for all those many places where out.write(char) is called, because UnsynchronizedBufferedWriter is known to be final.

The clean way of doing it is using that as a type in all TextWriter constructors and their subclasses. If there should ever be a need for some other form of writer you could change it back to a generic "Writer" type. The cast I used was so that I didn't have to change all the TextWriter subclasses.

Wolfgang.




Archive powered by MHonArc 2.6.24.

Top of Page