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

Re: use-when attribute?

Subject: Re: use-when attribute?
From: Geert Josten <Geert.Josten@xxxxxxxxxxx>
Date: Mon, 20 Dec 2004 19:01:25 +0100
Re:  use-when attribute?
In short, it isn't hard for a system to evaluate this expression in a single
scan, or perhaps three scans, and there is no need to allocate any memory
for temporary results.

All true (a through e), but how is a mere user like supposed to know what is optimized and what not. I was about to ask what is quicker: //a|//b|//c or //*[self::a or self::b or self::c] (an 'optimization' I often do myself). But if I understand correctly, you say that it is most likely that both are optimized to the same and therefor equally fast?


Even if the result of //a|//b|//c is assigned to a variable and you then do
count() on the variable, the system may be able to tell that it doesn't need
to allocate memory to hold the value (it might be able to see that it's only
used once).

Yes, very true, but I couldn't think that quickly of any other testcase. Do you have suggestion that is hard to optimize and therefor a reliable testcase?


The main reason the key is slower in this case is that you are only using it
once. But there's no good reason for ever using a key with a fixed use
expression more than once, because you could always put the result of the
first evaluation in a variable. So yes, I can't see any reason for using
this construct.

Using it once _and_ with a fixed use value. Twice inefficient...


Cheers,
Geert

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.