You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Willy Reinhardt <wr...@novell.com> on 2004/10/01 12:24:48 UTC

Rép. : RE: Conversion - performance

Thanks for your answer Ben.

I use a template that retrieve the Max date (attribute of an element)
for a node.

The template is the following :
-------------------------------------------------
    <xsl:template name="tFindMax">
          <xsl:param name="pNodes" />
          <xsl:param name="pNodeCount" />
          <xsl:param name="pCtr"/>
          <xsl:param name="pLastMax" select="0" />
          <xsl:param name="pDateParam" />
          <xsl:variable name="vdate"
select="concat(substring-after(substring-after($pNodes[$pCtr], '.'),
'.'), substring-before(substring-after($pNodes[$pCtr], '.'), '.'),
substring-before($pNodes[$pCtr], '.'))" />
          <xsl:variable name="vTemp">
               <xsl:choose>
                    <xsl:when test="(number($vdate) &lt;=
number($pDateParam)) and (number($vdate) &gt;= number($pLastMax))">
                    	<xsl:value-of select="$vdate"/>
                    </xsl:when>
                    <xsl:otherwise>
                    	<xsl:value-of select="$pLastMax"/>
                    </xsl:otherwise>
               </xsl:choose>
          </xsl:variable>

          <xsl:choose>
               <xsl:when test="$pCtr &lt; $pNodeCount">
                    <xsl:call-template name="tFindMax">
                         <xsl:with-param name="pNodes"
select="$pNodes"/>
                         <xsl:with-param name="pNodeCount"
select="$pNodeCount"/>
                         <xsl:with-param name="pCtr" select="$pCtr +
1"/>
                         <xsl:with-param name="pLastMax"
select="$vTemp"/>
                         <xsl:with-param name="pDateParam"
select="$pDateParam "/>
                    </xsl:call-template>
               </xsl:when>
               <xsl:otherwise>
				  <xsl:choose>
               		<xsl:when test="$vTemp != 0">
               			<xsl:value-of
select="concat(substring($vTemp, 7, 2), '.', substring($vTemp, 5, 2),
'.', substring($vTemp, 1, 4))"/>
               		</xsl:when>
               		<xsl:otherwise>
               			<xsl:value-of select="$vTemp" />
               		</xsl:otherwise>
               	   </xsl:choose>
               </xsl:otherwise>
          </xsl:choose>
     </xsl:template>
-------------------------------------------------

It is called like that :
-------------------------------------------------
  <xsl:template match="livre">
    <xsl:variable name="vnocourant" select="@no"/>
    <xsl:variable name="mon_no1" select="livre[@no=$vnocourant]/@date"
/>
    <xsl:variable name="vMaxDate">
	  <xsl:call-template name="tFindMax">
    	<xsl:with-param name="pNodes" select="$mon_no1"/>
        <xsl:with-param name="pNodeCount" select="count($mon_no1)"/>
        <xsl:with-param name="pCtr" select="1"/>
        <xsl:with-param name="pLastMax" select="0"/>
        <xsl:with-param name="pDateParam" select="$date" />
      </xsl:call-template>
    </xsl:variable>

<!-- then I can use the variable $vMaxDate -->
  </xsl:template>
-------------------------------------------------

Probably this function reduce performances.
Any suggestion ?

I use Cocoon 2.1.5.1 on BEA with JDK 1.4.1
I don't have the server JVM parameters info actually. Do you think I
should pass some particular parameters (I don't think it is a memory
problem, only the processor work at 100% during all the convertion
time).

Thanks
Olivier


>>> ben_pope@NOSPAMhotmail.com 01/10/04 11:48 >>>
Some further details would be useful:

Sample data (not all of it, but an idea of it's complexity)
XSLT

Cocoon version, container version (Tomcat etc)
Caching
JVM info (version, parameters)

Another issue is actually the time it takes for your browser to render
the
page, which can be a long time for large files.

There are many techniques for improving performance, the first is often
XSLT
design.

Ben


-----Original Message-----
From: Olivier Bleses [mailto:obleses@novell.com] 
Sent: 01 October 2004 10:40
To: users@cocoon.apache.org
Cc: Olivier Bleses
Subject: Conversion - performance


Hi,

I have performance problems when generating documents.
For a file with a size of 517 Ko, it takes more than 2 minutes to
generate
the html file (1373 Ko). For this generation, I wrote 2 xsl (and I
reference
the docbook.xsl) and I use Xalan 2.6.0. The result is ok but how can I
improve performance ?

Thanks
Olivier

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Rép. : RE: Conversion - performance

Posted by Ben Pope <be...@NOSPAMhotmail.com>.
Hi,

I'm not sure what your data looks like, perhaps a short excerpt would be
useful.

It might be quicker to sort them and select the first element.  Performance
would depend on the number of dates you have and the algorithms in use, but
either way it would make your template easier to read and is unlikely to be
slower :-)

Since you pass a lot of parameters in, the XSLT cannot be "compiled".  It
might be an idea to pass the parameters to one XSLT to format the data in
one way, and then cascade a second stylesheet that does as much as it can,
that does not rely on variables to render the HTML.  The second stylesheet
could then be compiled.

Short examples of input and required output would be ideal.

It's always worth throwing some more memory at the JVM to see if it helps.

Ben.



-----Original Message-----
From: Willy Reinhardt [mailto:wreinhardt@novell.com] 
Sent: 01 October 2004 11:25
To: users@cocoon.apache.org
Subject: Rép. : RE: Conversion - performance


Thanks for your answer Ben.

I use a template that retrieve the Max date (attribute of an element) for a
node.

The template is the following :
-------------------------------------------------
    <xsl:template name="tFindMax">
          <xsl:param name="pNodes" />
          <xsl:param name="pNodeCount" />
          <xsl:param name="pCtr"/>
          <xsl:param name="pLastMax" select="0" />
          <xsl:param name="pDateParam" />
          <xsl:variable name="vdate"
select="concat(substring-after(substring-after($pNodes[$pCtr], '.'), '.'),
substring-before(substring-after($pNodes[$pCtr], '.'), '.'),
substring-before($pNodes[$pCtr], '.'))" />
          <xsl:variable name="vTemp">
               <xsl:choose>
                    <xsl:when test="(number($vdate) &lt;=
number($pDateParam)) and (number($vdate) &gt;= number($pLastMax))">
                    	<xsl:value-of select="$vdate"/>
                    </xsl:when>
                    <xsl:otherwise>
                    	<xsl:value-of select="$pLastMax"/>
                    </xsl:otherwise>
               </xsl:choose>
          </xsl:variable>

          <xsl:choose>
               <xsl:when test="$pCtr &lt; $pNodeCount">
                    <xsl:call-template name="tFindMax">
                         <xsl:with-param name="pNodes" select="$pNodes"/>
                         <xsl:with-param name="pNodeCount"
select="$pNodeCount"/>
                         <xsl:with-param name="pCtr" select="$pCtr + 1"/>
                         <xsl:with-param name="pLastMax" select="$vTemp"/>
                         <xsl:with-param name="pDateParam"
select="$pDateParam "/>
                    </xsl:call-template>
               </xsl:when>
               <xsl:otherwise>
				  <xsl:choose>
               		<xsl:when test="$vTemp != 0">
               			<xsl:value-of
select="concat(substring($vTemp, 7, 2), '.', substring($vTemp, 5, 2), '.',
substring($vTemp, 1, 4))"/>
               		</xsl:when>
               		<xsl:otherwise>
               			<xsl:value-of select="$vTemp" />
               		</xsl:otherwise>
               	   </xsl:choose>
               </xsl:otherwise>
          </xsl:choose>
     </xsl:template>
-------------------------------------------------

It is called like that :
-------------------------------------------------
  <xsl:template match="livre">
    <xsl:variable name="vnocourant" select="@no"/>
    <xsl:variable name="mon_no1" select="livre[@no=$vnocourant]/@date"
/>
    <xsl:variable name="vMaxDate">
	  <xsl:call-template name="tFindMax">
    	<xsl:with-param name="pNodes" select="$mon_no1"/>
        <xsl:with-param name="pNodeCount" select="count($mon_no1)"/>
        <xsl:with-param name="pCtr" select="1"/>
        <xsl:with-param name="pLastMax" select="0"/>
        <xsl:with-param name="pDateParam" select="$date" />
      </xsl:call-template>
    </xsl:variable>

<!-- then I can use the variable $vMaxDate -->
  </xsl:template>
-------------------------------------------------

Probably this function reduce performances.
Any suggestion ?

I use Cocoon 2.1.5.1 on BEA with JDK 1.4.1
I don't have the server JVM parameters info actually. Do you think I should
pass some particular parameters (I don't think it is a memory problem, only
the processor work at 100% during all the convertion time).

Thanks
Olivier


>>> ben_pope@NOSPAMhotmail.com 01/10/04 11:48 >>>
Some further details would be useful:

Sample data (not all of it, but an idea of it's complexity) XSLT

Cocoon version, container version (Tomcat etc)
Caching
JVM info (version, parameters)

Another issue is actually the time it takes for your browser to render the
page, which can be a long time for large files.

There are many techniques for improving performance, the first is often XSLT
design.

Ben


-----Original Message-----
From: Olivier Bleses [mailto:obleses@novell.com] 
Sent: 01 October 2004 10:40
To: users@cocoon.apache.org
Cc: Olivier Bleses
Subject: Conversion - performance


Hi,

I have performance problems when generating documents.
For a file with a size of 517 Ko, it takes more than 2 minutes to generate
the html file (1373 Ko). For this generation, I wrote 2 xsl (and I reference
the docbook.xsl) and I use Xalan 2.6.0. The result is ok but how can I
improve performance ?

Thanks
Olivier

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org