Re: [xsl] how to estimate speed of a transformation

Subject: Re: [xsl] how to estimate speed of a transformation
From: David Tolpin <dvd@xxxxxxxxxxxxxx>
Date: Thu, 11 Dec 2003 14:54:49 +0400 (AMT)
> 
>   one should have the right to expect that for each n the computation is performed
>   once, and if a template is called with the same value of 'n' repeatedly, it does not
>   spend time on computing doctitle again.
> 
> The system doesn't have to re-calculate; it could cache the values so if
> it sees the same n again, simply re-use it.
> 

That's clear and obvious. What kinds of expressions and when are 'cached' in each
of the available processors? 

Since such 'caching' changes computation complexity, what features should expressions
possess to be safely used in this way? 

For example, for each node in a sequence, will computing following-sibling::*[name()=name(following-sibling::*[1])][2]
take twice more time than following-sibling::*[name()=name(following-sibling::*[1])][1]? Or will it take almost
the same time? What about 200 and 100 instead of 2 and 1?

Results are different with different processors, with constant time in the best case,
quadratic time in the worst one.

- Is the same time a feature of the language or a clever optimization? 
- Can I rely on constant time for this expression in my stylesheets? What if in a later
  version of the same processor this optimization will be dropped due to other concerns?

Stylesheets can be long and sophisticated. If it becomes too slow, is it a bug in the algorithm
or in the processor?

David Tolpin

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


Current Thread