Re: [xsl] Newbie question on XSL transformations: multiple sorts on element attr

Subject: Re: [xsl] Newbie question on XSL transformations: multiple sorts on element attr
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 08 Feb 2007 10:37:47 +0100
Ronan Klyne wrote:
(Hello)

Are there any published numbers anywhere to demonstrate this?

And do you mean that XSLT2.0 allows you to write faster code, or that
the processors are better?

Ronan

It is not that trivial, because the languages differ so much. I am not sure about published figures, but I remember a post on this list by Dimitre Novatchev (I hope I am right about the poster's name) who showed with FXSL a magnitude of performance gains.


That said, a simple example shows what can be achieved and why it is so significant. In XSLT 2, you can write "replace($value, "someString", "someOtherstring"), to replace all occurrences of 'someString' with 'someOtherstring' in the value $value (these can be regular expressions, but parsing a regex in XSLT 1 is so utterly complex and time consuming, the comparison wouldn't be fair). The same replace will take a recursive template in XSLT 1.

Even without running the tests, you can imagine that XSLT 2 processor designers can optimize a single function with strict semantics much easier than they would with a complex recursive template.

Similar performance gains are made with XSLT having a new type system, with strong typing and sequences, which both were not there in XSLT 1. Not having a Node type just about everywhere makes for pretty amazing performance gains.

There are very many examples of XSLT 2 outperforming XSLT 1. But comparisons are hardly fair, as it almost feels like comparing a calculation program written in MS DOS Batch language (yes, it can be done!) to one that is made in JavaScript. Both are interpreted, but the languages differ a lot in their capabilities making comparising both look bad.

-- Abel

Current Thread