DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20710>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20710 Performance Problems-NEED HELP! ------- Additional Comments From [EMAIL PROTECTED] 2003-07-11 19:43 ------- First, my performance analysis is only for XSLTC. For XSLTC, half of the execution time is spent in the evaluation of global variables (there are many global vars in this testcase). The performance bottle is in the redundant expressions. For example, "/HBD/APPLICATION_CONTEXT/SECURE" and "/HBD/APPLICATION_CONTEXT/USERREG" have a redundant parent "/HBD/APPLICATION_CONTEXT". This common expression is evaluated twice. We have been talking about an optimization feature called Redundant Expression Elimination (REE) which will give us a significant improvement (more than 40%) for this testcase. Before REE is implemented, you can modify your stylesheet to reduce the number of redundant expressions. Another trick is to replace "//node" by "/descendant::node" if they are syntactically equivalent in your stylesheet (they are not the same in general). The following five variable assignments are the most expensive ones: <xsl:variable name="currTopicId" select="//TOPIC_LIST [EMAIL PROTECTED]'true']/TOPIC_HISTORY/TOPIC[position() = last()]/KEY/ID"/> <xsl:variable name="parentTopicId" select="//TOPIC_LIST [EMAIL PROTECTED]'true']/TOPIC_HISTORY/TOPIC[position() = last()-1 and position()! =1]/KEY/ID"/> <xsl:variable name="currTopicType" select="//TOPIC_LIST [EMAIL PROTECTED]'true']/TOPIC_HISTORY/TOPIC[position() = last()]/KEY/TYPE"/> <xsl:variable name="currTopicGC" select="//TOPIC_LIST [EMAIL PROTECTED]'true']/TOPIC_HISTORY/TOPIC[position() = last()]/KEY/HEADINGGROUPC"/> <xsl:variable name="currTopicName" select="//TOPIC_LIST [EMAIL PROTECTED]'true']/TOPIC_HISTORY/TOPIC[position() = last()]/NAME"/> You can introduce some variables to hold the intermediate results to get rid of redundant expressions. Also replace "//" by "/descendant::". The results will be the following: <xsl:variable name="tmp1" select="/descendant::TOPIC_LIST [EMAIL PROTECTED]'true']/TOPIC_HISTORY"/> <xsl:variable name="tmp2" select="$tmp1/TOPIC[last()]"/> <xsl:variable name="tmp3" select="$tmp2/KEY"/> <xsl:variable name="currTopicId" select="$tmp3/ID"/> <xsl:variable name="parentTopicId" select="$tmp1/TOPIC[position() = last()-1 and position()!=1]/KEY/ID"/> <xsl:variable name="currTopicType" select="$tmp3/TYPE"/> <xsl:variable name="currTopicGC" select="$tmp3/HEADINGGROUPC"/> <xsl:variable name="currTopicName" select="$tmp2/NAME"/> This will give you the same output result. My manual testing shows that this change alone gives me an improvement between 25%-30%. You can apply the same rule to other variables to remove redundants.
