Re: [xslt] RE: [xml] does xsltproc caches subexpressions



On Monday 22 May 2006 10:54, Buchcik, Kasimier wrote:
[...]

> The tiny "[1]) = 1" is the part 
> of the expression, which e.g. Saxon can use to optimize the evaluation.
> With 1732 nodes in the key, Saxon took ~12s on a test box, while Libxslt
> took ~50s for evaluation of this expression. On the other hand, if I
> changed this expression to use "count(.....) > 1" (i.e. without the
> "[1]")
> then Saxon needed already ages to process 300 nodes, while Libxslt times
> were still linear. So Saxon is optimized, if "[1]" is used;
> Libxslt/Libxml2
> not.

What kind of optimizations does libxml2 do on predicated, in general?

For the "[1]" predicate, I think two types can be done(when we're talking 
about implementations like Saxon and libxml2):

* Analysis of context dependency, and as result conclude how the predicate 
must be evaluated. For example, "1" doesn't depend on the context and will 
therefore always evaluate to the same. However, an expression involving "." 
would have to be evaluated each time. End point, some predicates only have to 
be evaluated once.

* Early exit. For example, one knows that "1" will never match beyond the 
first item.

Saxon implements both.


Cheers,

		Frans


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]