Project

Profile

Help

Saxon optimization

Added by Anonymous about 18 years ago

Legacy ID: #3585466 Legacy Poster: philippe drix (ph-d)

Hi, Let us consider this XSLT skeleton : template begin xslt instructions ... call template 1 template 1 xslt instructions ... call template 2 template 2 xslt instructions ... call template 3 template i xslt instructions ... call template i+1 ... All the "call template" instruction are the last instruction of the template. I wonder if saxon compiler sees that this skeleton may be optimized like this : template begin xslt instructions ... call template 1 call template 2 call template 3 ... call template i ... template 1 xslt instructions ... template 2 xslt instructions ... template i xslt instructions ... ... Regards -- Ph D


Replies (1)

RE: Saxon optimization - Added by Anonymous about 18 years ago

Legacy ID: #3586160 Legacy Poster: Michael Kay (mhkay)

Yes, Saxon implements tail-call optimization for template calls, so if the last thing in a template is a call-template instruction, the stack will be popped before executing the call-template rather than after. This is intended to benefit deeply recursive calls, but it's done whether or not the call is recursive. Michael Kay

    (1-1/1)

    Please register to reply