[Haskell-cafe] Re: Am I doing it right?
Achim Schneider
barsoap at web.de
Thu Sep 25 04:41:38 EDT 2008
Daniel Fischer <daniel.is.fischer at web.de> wrote:
> The fast searching function on ByteStrings has already been written
> for you :)
>
That's in ghc 6.8.3, which is not in gentoo but only in the haskell
overlay, which means that all blame goes to the gentoo maintainers for
being utterly out of date.
The KMP import works like a charm.
findSubstring is only defined for strict bytestrings... try
running those benchmarks again, this time on data bigger than your ram.
Not to mention that it's deprecated.
The really interesting topic is hacking Parsec to use KMP search on
"manyTill anyChar (try string match), or rather any recursive try
involving combinators that can calculate the position for the next
candidate match as a side effect.
PS: Thank you for not pointing out that my original code crashes on
B.tail B.empty in some cases, or even just that it can't replace
overlapping matches at all.
--
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or broadcasting of this signature prohibited.
More information about the Haskell-Cafe
mailing list