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

Re: Does <xsl:copy> use a lot of memory? Is there an

Subject: Re: Does <xsl:copy> use a lot of memory? Is there an alternative that is more efficient?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 03 Sep 2012 09:31:47 +0100
Re:  Does <xsl:copy> use a lot of memory? Is there an
On 02/09/2012 16:34, Dimitre Novatchev wrote:
In case the input document is parsed successfully, wouldn't the use of
<xsl:sequence> (instead of <xsl:copy-of>) result in using less memory?


In most circumstances both will do exactly the same thing:

- if you're writing to the serializer, both emit a stream of events representing a traversal of the selected nodes
- if you're writing to the content of an element in a temporary tree, both cause a physical copy to be made


If you're returning the result of a function, xsl:sequence returns a reference to an existing node while xsl:copy-of (in Saxon) returns a "virtual copy" which shares memory with the original. Processing the virtual copy is more expensive because you have to prevent axis navigation straying outside the subtree of the node that was "copied", but this is a processing cost not a memory cost.

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.