[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT 4: map serialization

Subject: Re: XSLT 4: map serialization
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 25 Nov 2020 15:03:44 -0000
Re:  XSLT 4: map serialization
> As for this particular example, I suspect that building an XML document
incrementally from a sequence of single elements will have performance
implications -- similar to concatenating to a string many times.
>

It's true that bottom-up construction of a tree can be very expensive because
of the need for copy operations. However, the copying can be avoided with
careful optimization. For example with inline construction like

element('A', (element('B', ()), element('C', ()))

you can avoid copying B and C when attaching them to A either by recognising
this pattern statically, or by some kind of run-time laziness.

On the Java side I've produced an API called the "sapling" model where the
functions such as element() here don't construct a full XPath-navigable tree,
but just a skeletal tree, whose construction is completed lazily the first
time it is used for XPath navigation; this avoids the repeated copying of
intermediate subtrees during construction. (I believe Javascript processor use
a similar approach to avoid string copying for repetitive string
concatenation).

Michael Kay
Saxonica

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.