Re: Levenshtein distance in XSLT 2.0

I’ve now made sufficient tweaks so both the function and the template versions are tail-recursive.

The template version wasn’t optimizing tail recursion in Saxon 8.9 for two reasons: (a) there’s no sensible static type inferencing being done for xsl:call-template (I think I was worried about the inferencing going into a loop when the call is recursive), and (b) there’s a blanket switch that says if the return type is declared, don’t do tail call optimization.

Keep these examples coming in: the only way to improve an optimizer is to give it lots of exercise.

The thing that really needs doing now (it’s long overdue) is some static analysis on apply-templates, using type information to narrow down the field of possible matching template rules.

Reply

The content of this field is kept private and will not be shown publicly.