xsl-list
[Top] [All Lists]

Re: [xsl] How expensive is //?

2006-09-09 13:16:23
No performance issues. Just idle curiosity. As you say, it doesn't
really seem to make a measurable difference. Kind of funny I bring it
up at all.

But suppose you have a hypothetical root Records with one Record and
100,000 children directly under it. I was wondering if doing
Records/Record/child versus //child would make any difference.

-S

On 9/8/06, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
> Is // (memory) equivalent to /Records/Record when there is
> only one Records, and only one child Record?
>

It depends entirely on your processor.

For Saxon: the first time you do //x on a given document (for a given x) it
searches the whole document looking for elements named x. In the majority of
cases, this will take longer than an explicit path expression such as
/a/b/c/x. However, the list of x elements that it finds is saved as a kind
of index, linked to the document node, so that the next time you do //x on
the same document it already knows the answer: which is therefore cheaper
than repeating the /a/b/c/x query. This also applies if the //x is part of a
longer path expression.

But you seem to be suggesting that your document is tiny, in which case none
of this makes any measurable difference. Do you actually have a performance
problem, and if so what is it?

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>