Re: Memoïzation (Re: Levenshtein distance in XSLT 2.0)

Actually, Saxon has a saxon:memo-function extension attribute that you can use to indicate that a given function should be memoised. In this case, adding saxon:memo-function="yes" to the naive implementation makes it function a lot better (eg comparing two 50-character strings in 2430ms), but not as well as the dynamic programming method (which compares them in 113ms).

I think that since memoisation is purely to do with performance, rather than functionality, it doesn’t belong in an XSLT spec. An XSLT processor could currently do automatic memoisation of certain functions or templates if it thought it could detect ones where it would lead to a performance improvement.

Reply

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