|
|
||||
|
Re: Re: Tail recursive functions
by
Michael Kay
Further thoughts on tail calls to a different function. It's easy enough to reuse the XPathContext object and the stackframe that it contains when calling a different function. But these objects are on the Java heap, which is rarely a cause of problems. It's not so easy to do a tail call to a different function without consuming Java stack space. Saxon was doing this by returning to the original caller of the first function with a request to call the second one, and this is where the design became fragile.
However, I think I can reduce the amount of Java stack space used by such calls (as well as reducing heap space) by returning all the way down to the outermost level of the function before doing the tail call. This is probably still worthwhile.
|
Search
Recent Comments
Recent Articles
Month Archive
|
|||