[xslt] Performance issue



Hello

Sorry for the very vague subject…

We are facing a performance issue on a processing using Python lxml.

The legacy, running on CentOS 7, with lxml 4.3.4 / libxml 2.9.1 / libxslt 1.1.28 works fine (5'' to 10’’ in biggest use-case)

We are deploying this process to CentOS 8 Stream, which bumped our libs to lxml 4.7.1 / libxml 2.9.7 / libxslt 1.1.32.

And then, our Python processing time increased by a x20 factor.

After digging further, we pinned the performance issue to be in libxslt, by comparing the time taken by xsltproc for the same xml and xslt files on CentOS 7 and CentOS 8 Stream.

The xslt used is at the end of this message.

I’m not an expert of XSL, but is there any chance that this would be linked to https://gitlab.gnome.org/GNOME/libxslt/-/issues/24 and https://bugzilla.gnome.org/show_bug.cgi?id=777432 (fixed after 1.1.28)?

Best regards

Geoffroy

The XSL used:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" encoding="UTF-8"/>
  <xsl:param name="indent-increment" select="'  '"/>

  <xsl:template name="newline">
    <xsl:text disable-output-escaping="yes">
</xsl:text>
  </xsl:template>

  <xsl:template match="comment() | processing-instruction()">
    <xsl:param name="indent" select="''"/>
    <xsl:call-template name="newline"/>
    <xsl:value-of select="$indent"/>
    <xsl:copy />
  </xsl:template>

  <xsl:template match="text()">
    <xsl:param name="indent" select="''"/>
    <xsl:call-template name="newline"/>
    <xsl:value-of select="$indent"/>
    <xsl:value-of select="normalize-space(.)"/>
  </xsl:template>

  <xsl:template match="text()[normalize-space(.)='']"/>

  <xsl:template match="*">
    <xsl:param name="indent" select="''"/>
    <xsl:call-template name="newline"/>
    <xsl:value-of select="$indent"/>
      <xsl:choose>
       <xsl:when test="count(child::*) > 0">
        <xsl:copy>
         <xsl:copy-of select="@*"/>
         <xsl:apply-templates select="*|text()">
           <xsl:with-param name="indent" select="concat ($indent, $indent-increment)"/>
         </xsl:apply-templates>
         <xsl:call-template name="newline"/>
         <xsl:value-of select="$indent"/>
        </xsl:copy>
       </xsl:when>
       <xsl:otherwise>
        <xsl:copy-of select="."/>
       </xsl:otherwise>
     </xsl:choose>
  </xsl:template>
</xsl:stylesheet>


Attachment: smime.p7s
Description: S/MIME cryptographic signature



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