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

On Mon, May 22, 2006 at 07:17:02PM +0200, Buchcik, Kasimier wrote:
> > What kind of optimizations does libxml2 do on predicated, in general?
> > 

  basically nearly nothing except [1] and [last()] optimizations

> The following might be a bit vague, since I only scratched Libxml2's
> XPath
> code.
> I think Libxml2 does only the "early exit" optimization; at least I
> haven't
> found code indicating the opposite. Although in the case of [n], it
> doesn't
> evaluate "n", but just triggers execution of optimized evaluation
> functions
> wrt the position. The 3 functions are:
> 1) xmlXPathCompOpEvalFirst()       - used for "[1]"
> 2) xmlXPathCompOpEvalLast()        - used for "last()"
> 3) xmlXPathNodeCollectAndTestNth() - used for "[n]"
> But there's one catch for the "early exit": In Libxml2 each predicate is
> evaluated on the node-set result of its preceding predicate; so the
> "early exit" is only possible at the last level of predicates.

  yes, that's my recollection too.
Basically my design rules were KISS and try to optimize only when hitting
something obviously slowing things down. There is a number ofpotential 
optimization option which could be done on the expression compiled tree
either at compilation time, or in context, but I never really spent much time
on those. Bug in those areas can also be extremely hard to catch :-)


Daniel Veillard      | Red Hat
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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