Re: [xslt] Cloning xsltStylesheet structures

On Fri, Dec 07, 2001 at 09:02:44AM +0100, Eric van der Vlist wrote:
> Hi,
> I hope you'll forgive the question from someone biaised by years of XSLT 
> processing in Java, but a common practice in Java when multithreading is 
> involved is to create stylesheet objects once, parse a stylesheet and 
> reuse the object by cloning it rather.
> These "pseudo compiled" stylesheets are much faster to use since the 
> parsing of the stylesheet is (in Java) an heavy operation.
> Would this be interesting as well when using libXSLT in multi threading 
> projects?
> If yes, I am wondering how this could be achieved. The xsltStylesheet 
> structure is including different kinds of information (some of them are 
> related to the stylesheets while other depend on the transformation 
> being run) and doesn't seem obvious to clone (at least without entering 
> in the details of its private structure).
> Is this something which is worth? planed at some point?

  Actually, there is very little informations associated to running
transformation kept in the stylesheet itself. And those are cache informations
used to speed up some of the processing.
  I would expect concurent transformations to be able to reuse the same
xsltStylesheetPtr for different processes. 
  The cache informations [*] could be moved on the transformation context
or the new libxml2 thread API could be reused to protect them, then
parallel reuse of a compiled stylesheet would be garanteed to be safe.


[*] this is the previous node which matched the predicate kept when using
    predicates in selectors. The XPath optimizer may also modify the compiled
    stylesheet (changing the XPath evaluation trees for faster evaluation
    depending on the usage pattern) but this is disabled as soon as reentrancy
    in the XPath engine is detected.

Daniel Veillard      | Red Hat Network  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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