You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Thomas F. O'Connell" <tf...@netcentral.com> on 2003/06/12 21:31:15 UTC

Re: optimizing transformations

I've got a rough answer to my own question of a few months ago in which
I wondered aloud to the list whether anyone had any benchmark results as
to which method of applying a transformation among filtering (xsl:choose/
xsl:if), matching, or selecting was most efficient.

I had a stylesheet being applied to XML containing on the order of 50,000
elements that used mostly filtering. Rewriting the stylesheet to use a
mixture of more intelligent matching and selecting resulted in consistent
speed improvements of between 30% and 40%. This goes against Sal Mangano's
results in XSLT Cookbook, where he suggests that filtering is actually
faster in Xalan, but i was never able to determine which version of Xalan
he was using. I'm using Xalan C++ 1.4.

To me, this makes sense because operations that occur in a match block
only get applied to portions of the document that are matched, whereas
filtering applies to all encountered nodes or nodesets. Thus, even if
you're only performing the body of an xsl:if block 1,000 times among
50,000 nodes, you might be performing the test against all 50,000.

Please correct me if these assumptions are mistaken, as this is more
common sense reasoning than studious code review evidence.

Anyway, I just figured I'd post to see if there's anything else in the way
of informal (or, even better, formal) benchmarks out there...

-tfo

--
Thomas F. O'Connell
Programmer
NetCentral
http://www.netcentral.com/
1814 Hayes Street
Nashville, TN 37203
p: 615.777.5304 x27
f: 615.777.5340