pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Law <exclusion@gmail.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Build HTML documentation using XSLT stylesheets by default
Date: Thu, 15 Dec 2016 12:30:17 +0300
Message-ID: <bfce8c4e-e200-9617-791a-4e05a054e698@gmail.com> (raw)
In-Reply-To: <20161201164925.poqw4zrnlbj5ex7a@alvherre.pgsql>
References: <20161201164925.poqw4zrnlbj5ex7a@alvherre.pgsql>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Hello Alvaro,

It's caused by the condition
<xsl:when test="function-available('suwl:unwrapLinks')">...
in the simple.xlink template 
(docbook/stylesheet/docbook-xsl/xhtml/inline.xsl). (This test executed 
for each xlink (~ 90000 times)).
Yes, it's inefficient but it doesn't affect build time (for me).
You can try to apply the attached patch and measure the time with it.
So If the performance is rather acceptable now I'd continue switch to 
XML, and get back to the performance issues after the switch.
(epub generation is much more slow, and I have developed a patch to 
speed up it too.)

Best regards,
Alexander

01.12.2016 19:49, Alvaro Herrera wrote:
> Pavel Stehule wrote:
>
>> It does much more intensive work with IO - I have feeling like there are
>> intensive fsync.
> You could prove that, by running "make html" under "strace -f -e
> trace=fsync" etc.  I just tried that, and I don't see any fsync.  I
> guess you could try other syscalls, or simply "-e trace=file".  Doing
> the latter I noticed an absolutely stupid number of attempts to open
> file
> /usr/lib/libxslt-plugins/nwalsh_com_xslt_ext_com_nwalsh_saxon_UnwrapLinks.so
> which deserves a WTF.
>

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

make-html-wo-nwalsh-search.patch (text/x-patch, 7.4K) download diff --git a/doc/src/sgml/stylesheet-speedup-xhtml.xsl b/doc/src/sgml/stylesheet-speedup-xhtml.xsl index ff08bef..60c9fd4 100644 --- a/doc/src/sgml/stylesheet-speedup-xhtml.xsl +++ b/doc/src/sgml/stylesheet-speedup-xhtml.xsl @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml" version='1.0'> @@ -292,4 +293,189 @@ </head> </xsl:template> + +<!-- from /usr/share/xml/docbook/stylesheet/docbook-xsl/xhtml/inline.xsl --> +<xsl:template name="simple.xlink"> + <xsl:param name="node" select="."/> + <xsl:param name="content"> + <xsl:apply-templates/> + </xsl:param> + <xsl:param name="linkend" select="$node/@linkend"/> + <xsl:param name="xhref" select="$node/@xlink:href"/> + + <!-- Support for @xlink:show --> + <xsl:variable name="target.show"> + <xsl:choose> + <xsl:when test="$node/@xlink:show = 'new'">_blank</xsl:when> + <xsl:when test="$node/@xlink:show = 'replace'">_top</xsl:when> + <xsl:otherwise/> + </xsl:choose> + </xsl:variable> + + <xsl:variable name="link"> + <xsl:choose> + <xsl:when test="$xhref and (not($node/@xlink:type) or $node/@xlink:type='simple')"> + + <!-- Is it a local idref or a uri? --> + <xsl:variable name="is.idref"> + <xsl:choose> + <!-- if the href starts with # and does not contain an "(" --> + <!-- or if the href starts with #xpointer(id(, it's just an ID --> + <xsl:when test="starts-with($xhref,'#') and (not(contains($xhref,'(')) or starts-with($xhref, '#xpointer(id('))">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <!-- Is it an olink ? --> + <xsl:variable name="is.olink"> + <xsl:choose> + <!-- If xlink:role="http://docbook.org/xlink/role/olink" --> + <!-- and if the href contains # --> + <xsl:when test="contains($xhref,'#') and @xlink:role = $xolink.role">1</xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:choose> + <xsl:when test="$is.olink = 1"> + <xsl:call-template name="olink"> + <xsl:with-param name="content" select="$content"/> + </xsl:call-template> + </xsl:when> + + <xsl:when test="$is.idref = 1"> + + <xsl:variable name="idref"> + <xsl:call-template name="xpointer.idref"> + <xsl:with-param name="xpointer" select="$xhref"/> + </xsl:call-template> + </xsl:variable> + + <xsl:variable name="targets" select="key('id',$idref)"/> + <xsl:variable name="target" select="$targets[1]"/> + + <xsl:call-template name="check.id.unique"> + <xsl:with-param name="linkend" select="$idref"/> + </xsl:call-template> + + <xsl:choose> + <xsl:when test="count($target) = 0"> + <xsl:message> + <xsl:text>XLink to nonexistent id: </xsl:text> + <xsl:value-of select="$idref"/> + </xsl:message> + <xsl:copy-of select="$content"/> + </xsl:when> + + <xsl:otherwise> + <a> + <xsl:apply-templates select="." mode="common.html.attributes"/> + <xsl:call-template name="id.attribute"/> + + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="$target"/> + </xsl:call-template> + </xsl:attribute> + + <xsl:choose> + <xsl:when test="$node/@xlink:title"> + <xsl:attribute name="title"> + <xsl:value-of select="$node/@xlink:title"/> + </xsl:attribute> + </xsl:when> + <xsl:otherwise> + <xsl:apply-templates select="$target" mode="html.title.attribute"/> + </xsl:otherwise> + </xsl:choose> + + <xsl:if test="$target.show !=''"> + <xsl:attribute name="target"> + <xsl:value-of select="$target.show"/> + </xsl:attribute> + </xsl:if> + + <xsl:copy-of select="$content"/> + + </a> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + + <!-- otherwise it's a URI --> + <xsl:otherwise> + <a> + <xsl:apply-templates select="." mode="common.html.attributes"/> + <xsl:call-template name="id.attribute"/> + <xsl:attribute name="href"> + <xsl:value-of select="$xhref"/> + </xsl:attribute> + <xsl:if test="$node/@xlink:title"> + <xsl:attribute name="title"> + <xsl:value-of select="$node/@xlink:title"/> + </xsl:attribute> + </xsl:if> + + <!-- For URIs, use @xlink:show if defined, otherwise use ulink.target --> + <xsl:choose> + <xsl:when test="$target.show !=''"> + <xsl:attribute name="target"> + <xsl:value-of select="$target.show"/> + </xsl:attribute> + </xsl:when> + <xsl:when test="$ulink.target !=''"> + <xsl:attribute name="target"> + <xsl:value-of select="$ulink.target"/> + </xsl:attribute> + </xsl:when> + </xsl:choose> + + <xsl:copy-of select="$content"/> + </a> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + + <xsl:when test="$linkend"> + <xsl:variable name="targets" select="key('id',$linkend)"/> + <xsl:variable name="target" select="$targets[1]"/> + + <xsl:call-template name="check.id.unique"> + <xsl:with-param name="linkend" select="$linkend"/> + </xsl:call-template> + + <a> + <xsl:apply-templates select="." mode="common.html.attributes"/> + <xsl:call-template name="id.attribute"/> + <xsl:attribute name="href"> + <xsl:call-template name="href.target"> + <xsl:with-param name="object" select="$target"/> + </xsl:call-template> + </xsl:attribute> + + <xsl:apply-templates select="$target" mode="html.title.attribute"/> + + <xsl:copy-of select="$content"/> + + </a> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$content"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + +<!-- in attempt to speed up `make html` + <xsl:choose> + <xsl:when test="function-available('suwl:unwrapLinks')"> + <xsl:copy-of select="suwl:unwrapLinks($link)"/> + </xsl:when> + <xsl:otherwise> + <xsl:copy-of select="$link"/> + </xsl:otherwise> + </xsl:choose> +--> + <xsl:copy-of select="$link"/> +</xsl:template> + </xsl:stylesheet>

view thread (31+ messages)  latest in thread

Message-ID: <bfce8c4e-e200-9617-791a-4e05a054e698@gmail.com>
Permalink:  ../bfce8c4e-e200-9617-791a-4e05a054e698@gmail.com/
Also on:    postgresql.org/message-id/bfce8c4e-e200-9617-791a-4e05a054e698@gmail.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: exclusion@gmail.com, alvherre@2ndquadrant.com, pavel.stehule@gmail.com, tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Build HTML documentation using XSLT stylesheets by default
  In-Reply-To: <bfce8c4e-e200-9617-791a-4e05a054e698@gmail.com>
  References: <20161201164925.poqw4zrnlbj5ex7a@alvherre.pgsql> <bfce8c4e-e200-9617-791a-4e05a054e698@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox