Subject: Re: [xsl] An observation on the performance of fn:transform From: "John Lumley john@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Fri, 3 Jul 2020 08:53:59 -0000 |
Hello world,Perhaps a argument for something akin to fn:compile-transform($options as map(*)) as function($options), which does the compilation once and returns an exectuable function. Before XSLT3 and xsl:evaluate, Saxon had (and still has) something similar for XPath: saxon:expression() and saxon:evaluate()
This isnbt a complaint, or explicitly a request for advice (though Ibm always happy for helpful suggestions), just an observation. The workflow for processing DocBook documents is roughly this pipeline:
1. Fixup the logical structure of the document (expand entities and replace entityref attributes with the corresponding fileref attributes). 2. Perform XInclude 3. Convert DocBook 4.x markup to 5.x markup if the source document appears to be DocBook 4.x (i.e., if its root element is in no namespace) 4. Perform transclusion[1] 5. Profile 6. Resolve annotations 7. Resolve XLinks (including external link bases)
.... So I coded that up. I now have an *eight* stage pipeline where the last stage does the transformation to HTML, cleanup of that HTML, and possible chunking. Itbs all still in one stylesheet with modes because I havenbt teased it apart yet, itbs just being run with fn:transform instead of with a mode in the same stylesheet.
The performance difference is interesting.
Running 1,426 tests through the 8 stage pipeline: 4m19s. Running 1,542 tests through the original 7 stages: 50s.
There are fewer tests in the former case because some of my XSpec tests just canbt work against the new driver; Ibll have to run two sets of tests which is kind of a drag, but I should be running separate tests for all the stages anyway so I guess thatbs just the way it is.
The performance difference is presumably because it takes ~0.15s to compile the main stylesheet each time. Which is, you know, pretty damned fast, but adds up if youbre going to do it thousands of times in a row. .....
-- *John Lumley* MA PhD CEng FIEE john@xxxxxxxxxxxx <mailto:john@xxxxxxxxxxxx> on behalf of Saxonica Ltd
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] An observation on the per, Norman Tovey-Walsh n | Thread | Re: [xsl] An observation on the per, Michael Kay mike@xxx |
Re: [xsl] An observation on the per, Martin Honnen martin | Date | Re: [xsl] An observation on the per, Michael Kay mike@xxx |
Month |