Altova Mailing List Archives


Re: [xsl] XSL: For-Each Efficient or Not?

From: Wendell Piez <wapiez@---------------->
To:
Date: 7/1/2002 7:48:00 AM
What Kevin says about the performance impact of complex matches would also 
seem to provide another reason why an XPath like



m:apply[factorof[not(preceding-sibling::*)]]



will be better than



m:apply[child::*[position()=1 and name()='factorof']]



which tests (what amounts to) the same thing. The first expression does not 
have to look at every child of the m:apply to see whether it meets the 
condition, and doesn't need to evaluate all those functions.



Not knowing the innards of any processor, of course, I'm only speaking in 
principle.



Cheers,
Wendell

At 12:15 PM 7/1/2002, you wrote:
And the complexity of the template match expressions in the stylesheets.
Simple tests on name or nodetype can be efficient but matches that involve
predicates are generally harder for a processor to index. These can cause
some processors to use sequential searching for a templates (slow for large
numbers of templates). I have seen the performance of some stylesheets
completely cripled by use of complex matches, e.g.,

<xsl:template match="m:apply[child::*[position()=1 and name()='factorof']]">



So its very specific to a processor/stylesheet pair and complex tests are
better done in for-each/if blocks if performance is more important than
maintainability.




======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.