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

Re: improving performance in creating ids

Subject: Re: improving performance in creating ids
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Apr 2019 14:53:20 -0000
Re:  improving performance in creating ids
> Thanks for your quick reply. the node identity comparison helped quite a
bit, although I am still around a minute for a full book of ids. I am not sure
how xsl:number would help here, and what kind of performance win it would give
over count(). I tried something with a nested transformation, but what should
I feed it?
>     <xsl:number select="*[last()]"/>
> works (given a set of preceding nodes) but it is slightly slower than a
count() in the xquery. Maybe I should be using xsl:number differently?

Saxon attempts to optimise xsl:number for the case where you are numbering
many nodes: it will try to detect cases where the result is going to be the
same as the previous execution plus 1. In fact in recent releases it is
rewritten to use an internal accumulator. Another way you can achieve a
similar effect "by hand" is with a memo function: if the ID for a node is
computed as the ID of the previous node plus 1, and the function that does
that is a memo function, then numbering N nodes will have performance
increasing linearly with N.

Michael Kay

Current Thread


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.
First Name
Last Name
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.