Quick Intro to XML performance

August 28th, 2007

Was just writing an email which included a two minute introduction to Java XML performance. I thought I’d quickly replicate it here:

There are a few key areas that I see to XML performance. All can have a huge effect – i.e. you could possibly increase performance 2-10x performance by tweaking any one of these.

1. Your XML parser. By far the fastest here is Woodstox. It is a StAX implementaiton, but it also supports SAX as well.

2. Your databinding implementation. The fastest ones are those that compile optimized xml readers/writers for your domain objects. JiBX is a good example.  SXC (which I wrote) is another. SXC provides compiled readers/writers for your JAXB context, which can speed it up quite a bit. After those two, the JAXB-RI is probably the next fastest. XMLBeans/XStream are mediocre as I recall.

3. The XML representation. Reading everything into a Document object is very memory and resource intensive. Modern databinding frameworks like JAXB, JiBX, etc can turn the XML stream directly into POJOs. Use those if at all possible.

9 Responses to “Quick Intro to XML performance”

  1. Richard Opalka Says:

    It’s not close related to your post, but it is about the configuration. Try it and maybe you will like it ;-) However it’s DOM based. Link follows:
    http://x2jb.sourceforge.net/

  2. anonymous Says:

    The fastest is VTD-XML (much faster than woodstox)
    http://vtd-xml.sf.net

  3. Elliotte Rusty Harold Says:

    Woodstox only claims to be an XML parser. Its apparent speed derives from taking shortcuts and failing to follow the complete XML 1.0 spec. If your data matters to you, don’t even consider it.

    Last I checked VTD-XML was also not a full XML parser.

  4. jzhang Says:

    test

  5. jzhang Says:

    Sorry for the empty post,

    XML 2007 is not the same as XML 1997

    As to additional path to faster XML try
    Index XML documents with VTD-XML
    http://webservices.sys-con.com/read/453082.htm

  6. Tatu (Cowtown Coder) Says:

    Elliotte, I do not know where you get your impression regarding Woodstox xml compliance, but you are incorrect with your allegations. Latest Woodstox versions (3.x series) are very much xml compliant, as indicated by, for example, high pass rate XMLTest/SAXTest pass rate.

    I suggest you do some basic fact checking before engaging in browse-by slandering.

  7. cheap homeowners insurance manatee county Says:

    cheap homeowners insurance manatee county

    goodies neigh harken heart gushes.

  8. competitive insurance us van Says:

    competitive insurance us van

    banqueting rapier discreteness dishonoring!bustard sufficiency

  9. health insurance individual nv Says:

    health insurance individual nv…

    bilking therapy?detaches Frau deadlocking?DECnet,…

Leave a Reply

You must be logged in to post a comment.