Menu

#19 DOM->XSLT-String translators could be made more efficient

open
5
2006-02-01
2006-01-30
No

I did a little investigation because I was concerned
about the performance of the XML translators that are
generated by metaboss - the method of building an
in-memory DOM graph and then transforming with XSLT is
not terribly efficient to my mind and would not scale
to large documents.

I suggest looking at using the SAX API instead - the
transformers could trivially be changed to write to the
SAX ContentHandler interface and then you can
substitute different ContentHandler implementations to
perform different tasks - to generate a DOM graph, or
serialize to a Writer. JAXP also provides a
TransformHandler that allows XSLT implementations to
perform XSL transformation from a SAX event stream.
This is much more efficient even for XSL where the
whole document must be in memory - SAXON XSLT for
example will build a 'tinytree' DOM graph for
transformation which is vastly more efficient for
transforms than a standard Xerces DOM.

Attached is a scratch project consisting of a class
OrderSAXSerializer which shows how to write an STOrder
to a ContentHandler interface. The class also provides
a static toXMLString() method which performs the same
task as TRSTOrder. For comparison I compared 10,000
cycles of serializing to text using the current
generated transformer vs. this class. The results on
my PC are pretty clear:

Run with TRSTOrder

10000 cycles in 42578ms.

Run with OrderSAXSerializer

10000 cycles in 2110ms.

Thought this was worth passing on anyway...

cheers,

Evan.

Discussion

  • Evan Bottcher

    Evan Bottcher - 2006-01-30
     
  • Rost Vashevnik

    Rost Vashevnik - 2006-02-01

    Logged In: YES
    user_id=883678

    Hello !

    This message is to notify you that someone from MetaBoss team
    have had a look at your feature request, it was accepted and is
    now awaiting resolution. This means that someone from the
    MetaBoss team will have a closer look at it and formulate a
    response to you (most likely within 48 hours).

    Please note that in addition to the Sourceforge support facilities
    we maintain a FAQ and Forum at www.metaboss.com. If you have
    not already done so, we suggest that you visit our site and search
    for possible clues to your problem.

    Please also note that all MetaBoss users are free to use any
    support channel they like, however, in order to enjoy VIP Support,
    MetaBoss Commercial License Holders must submit their questions
    to the Forum at www.metaboss.com.

    Thank you for your contribution to MetaBoss

    MetaBoss team

     
  • Rost Vashevnik

    Rost Vashevnik - 2006-02-01
    • assigned_to: nobody --> metaboss
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.