[Haskell-cafe] Substring replacements

ajb at spamcop.net ajb at spamcop.net
Thu Dec 15 00:25:19 EST 2005

G'day all.

Quoting Branimir Maksimovic <bmaxa at hotmail.com>:

> After seeing that your program is fastest (I've also tried one from
> http://haskell.org/hawiki/RunTimeCompilation but perhaps I'm not
> that good in converting to search replace?)

You probably did it right, but you could post your version to the
list if you want me to take a look.

When I wrote the RunTimeCompilation code, it wasn't intended to be a
shining example of efficiency, merely an illustration.  Remember
that it's doing TWO things: compiling the pattern to code, and then
performing the search.  The compilation phase is likely to be much
slower than the search, so the speedup (if any!) would only be realised
the SECOND time that you searched a string using the same pattern.
(Assuming you re-used the compiled match code, of course!)

Andrew Bromage

More information about the Haskell-Cafe mailing list