From e8306745e3504c642f7abad411139d5630e29fac Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 18 Aug 2016 12:00:00 -0400 Subject: [PATCH] doc: Speed up XSLT builds The upstream XSLT stylesheets use some very general XPath expressions in some places that end up being very slow. We can optimize them with knowledge about the DocBook document structure and our particular use thereof. For example, when counting preceding chapters to get a number for the current chapter, we only need to count preceding sibling nodes (more or less) instead of searching through the entire node tree for chapter elements. This change attacks the slowest pieces as identified by xsltproc --profile. This makes the HTML build roughly 10 times faster, resulting in the new total build time being about the same as the old DSSSL-based build. Some of the non-HTML build targets (especially FO) will also benefit a bit, but they have not been specifically analyzed. With this, also remove the pg.fast parameter, which was previously a hack to get the build to a manageable speed. Alexander Lakhin , with some additional tweaking by me --- doc/src/sgml/stylesheet-common.xsl | 8 +- doc/src/sgml/stylesheet-speedup-common.xsl | 94 ++++++++ doc/src/sgml/stylesheet-speedup-xhtml.xsl | 252 +++++++++++++++++++++ doc/src/sgml/stylesheet.xsl | 1 + 4 files changed, 350 insertions(+), 5 deletions(-) create mode 100644 doc/src/sgml/stylesheet-speedup-common.xsl create mode 100644 doc/src/sgml/stylesheet-speedup-xhtml.xsl diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl index de3637624af..e3841130eb7 100644 --- a/doc/src/sgml/stylesheet-common.xsl +++ b/doc/src/sgml/stylesheet-common.xsl @@ -7,11 +7,10 @@ all output formats (HTML, HTML Help, XSL-FO, etc.). --> + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/src/sgml/stylesheet-speedup-xhtml.xsl b/doc/src/sgml/stylesheet-speedup-xhtml.xsl new file mode 100644 index 00000000000..8428dc58700 --- /dev/null +++ b/doc/src/sgml/stylesheet-speedup-xhtml.xsl @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Error: If you change $chunk.section.depth, then you must update the performance-optimized chunk-all-sections-template. + + + + + + + + + + + + + + + diff --git a/doc/src/sgml/stylesheet.xsl b/doc/src/sgml/stylesheet.xsl index 7967b361dd8..631fcc4edfc 100644 --- a/doc/src/sgml/stylesheet.xsl +++ b/doc/src/sgml/stylesheet.xsl @@ -6,6 +6,7 @@ + -- 2.39.5