Skip to Content.
Sympa Menu

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

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Wolfgang Hoschek <whoschek AT lbl.gov>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Serializer performance patches
  • Date: Wed, 29 Jun 2005 16:30:51 -0400

After investigating this further, I'm fairly convinced that the performance gain Wolfgang found is real, but I don't think my initial hypothesis as to where that came from is correct. The "slow path" is doing more than simply looking for characters that need to be escaped. It's also counting characters for purposes of line breaks and indents and so forth; and I think most of the speed gain in this proposal comes from avoiding that. The failing unit tests post-patch all seem to indicate places where the the fast path failed to update fields the slow path would have caught.

I've had a FastSerializer class in my pantry (experimental code I don't necessarily make public) for a while now, and it shows numbers on my system that are close to what this patch from Wolfgang provides; not quite as fast but within 20%, and definitely faster than the usual Serializer. FastSerializer is not a subclass of Serializer. It's a complete reimplementation that only does UTF-8 and provides no line breaking or indenting or other pretty-printing features. Possibly something like this needs to be published, but don't think it's a replacement for the standard Serializer class.

There is still about a 20% improvement from Wolfgang's work beyond what my own FastSerializer does. I'm not sure where that's coming from. I need to explore the differences between the two classes a little more to see what he may have done that I didn't.

However, whichever way we go, I don't think this patch can work with the existing Serializer. It breaks the pretty printing too badly. What it makes clear though is just how much pretty printing (even the possibility of it, whether you do it or not) costs in serialization time. It might be worth releasing a much simpler, non-configurable serializer.

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page