[ 
https://issues.apache.org/jira/browse/XALANJ-2459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12847158#action_12847158
 ] 

Cristian Vat edited comment on XALANJ-2459 at 3/18/10 11:18 PM:
----------------------------------------------------------------

I made a quick test and it seems much can be improved in the stylesheet given 
as example just by caching the result of the XPath expression 
"following-sibling::evenement[not(numEvt=$num and date=$date)][1]" or by 
applying the selection of the first node differently.

My results on current stylesheet and the improved ones (Xalan-J 2.7.1, JDK 
1.6.0_17_x64, Win7_x64):
--
Checking with initial stylesheet.
[XSLT] Average time (per transformation) for 20 transformations: 21.9 ms.
[XSLTC] Average time (per transformation) for 20 transformations: 10222.85 ms.
Checking with improved stylesheet.
[XSLT] Average time (per transformation) for 20 transformations: 9.2 ms.
[XSLTC] Average time (per transformation) for 20 transformations: 5.4 ms.
Checking with second (alternative) improved stylesheet.
[XSLT] Average time (per transformation) for 20 transformations: 8.35 ms.
[XSLTC] Average time (per transformation) for 20 transformations: 3.0 ms.
--

The first "improved" stylesheet just creates a variable with the result of 
"following-sibling::evenement[not(numEvt=$num and date=$date)][1]" and then 
uses that for the apply-templates and with-param calls.
The second improved stylesheet just changes the XPath from 
"following-sibling::evenement[not(numEvt=$num and date=$date)][1]" to 
"(following-sibling::evenement[not(numEvt=$num and date=$date)])[1]". Results 
are always the same.

While it's interesting that XSLTC behaves very slow for the example, it's 
really not a good example since the XPaths aren't optimized. With the better 
stylesheets XSLTC is always faster than the normal transformation.

      was (Author: cristian.vat):
    I made a quick test and it seems much can be improved in the stylesheet 
given as example just by caching the result of the XPath expression 
"following-sibling::evenement[not(numEvt=$num and date=$date)][1]" or by 
applying the selection of the first node differently.

My results on current stylesheet and the improved ones:
--
Checking with initial stylesheet.
[XSLT] Average time (per transformation) for 20 transformations: 21.9 ms.
[XSLTC] Average time (per transformation) for 20 transformations: 10222.85 ms.
Checking with improved stylesheet.
[XSLT] Average time (per transformation) for 20 transformations: 9.2 ms.
[XSLTC] Average time (per transformation) for 20 transformations: 5.4 ms.
Checking with second (alternative) improved stylesheet.
[XSLT] Average time (per transformation) for 20 transformations: 8.35 ms.
[XSLTC] Average time (per transformation) for 20 transformations: 3.0 ms.
--

The first "improved" stylesheet just creates a variable with the result of 
"following-sibling::evenement[not(numEvt=$num and date=$date)][1]" and then 
uses that for the apply-templates and with-param calls.
The second improved stylesheet just changes the XPath from 
"following-sibling::evenement[not(numEvt=$num and date=$date)][1]" to 
"(following-sibling::evenement[not(numEvt=$num and date=$date)])[1]". Results 
are always the same.

While it's interesting that XSLTC behaves very slow for the example, it's 
really not a good example since the XPaths aren't optimized. With the better 
stylesheets XSLTC is always faster than the normal transformation.
  
> XSLTC transformation 200 times slower than pure Xalan
> -----------------------------------------------------
>
>                 Key: XALANJ-2459
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2459
>             Project: XalanJ2
>          Issue Type: Bug
>      Security Level: No security risk; visible to anyone(Ordinary problems in 
> Xalan projects.  Anybody can view the issue.) 
>          Components: XSLTC
>    Affects Versions: 2.7.1
>         Environment: Java Sun JVM 1.5 and 1.6 on Linux 32 & 64 bit and 
> Windows XP 32 bit. (Core2Duo & Pentium4)
>            Reporter: Nicolas Albert
>            Priority: Critical
>         Attachments: xsltcbug.xml, xsltcbug.xsl
>
>
> I have an XSL stylesheet that perfom the transformation very very very slow 
> with XSLTC.
> 20 sec with no much data (vs 100 ms with Xalan), and I have never see it 
> success with the real amont of data (vs 900 ms with Xalan).
> I'll attach the xsl and a small xml.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
For additional commands, e-mail: xalan-dev-h...@xml.apache.org

Reply via email to