#180 Use exslt str:replace in apply-character-map when available

output: manpages
open
nobody
XSL (122)
5
2011-07-16
2011-07-16
Anonymous
No

The existing implementation is extremely slow and is quadractic in the number of entries in the character map (it would take an exceedingly clever implementation to recurse on $map.contents[position() > 1] in constant time). This cuts down the time to process the xslt portion of generating git's man pages by 50%.

We could shave off another decent amount (this is still maybe 10-15% of the processing time) or so with an even faster implementation. Ideally we'd build a hash table from character to replacement and then do once pass on the string, but I don't know if XSL can express that efficiently. (Also unlike both existing and replacement implementations, it would actually handle the case of 'a' -> "bb", 'b' -> "cc" correctly.)

Discussion