This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: XSL: For-Each Efficient or Not?


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@mulberrytech.com
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]