Did you try it with a "better" string-contains? IIRC the guile one is a naive string search (but in C) which could maybe be better if it was implemented as, say, a KMP search. The reference srfi-13 has one you could try. That could be faster for longer strings and longer patterns.
If that is faster, I can port a constant-space one that I have in ocaml somewhere in the catacombs of my.computer. -- Linus Björnstam On Fri, 20 Dec 2019, at 18:32, lloda wrote: > > This patch adds string-replace-substring that wingo posted to the > mailing list to (ice-9 strings). This is a commonly used function and a > good implementation isn't trivial, so I think it deserves inclusion. > > > > Attachments: > * 0001-Add-string-replace-substring-to-ice-9-string-fun.patch