[Haskell-cafe] Knuth Morris Pratt for Lazy Bytestrings implementation

Donald Bruce Stewart dons at cse.unsw.edu.au
Tue Jul 31 22:07:09 EDT 2007

> I've implemented KMP string searching for lazy bytestrings, and I'd
> like some help improving the performance of the code. I'd also like to
> know if it doesn't look correct - I've tested it pretty extensively
> but you never know ...
> I've been testing on a 7 MB file, where the search sequence is not
> found. Using strict byestrings, lazy bytestrings, and regular strings,
> I've found my algorithm is about twice as slow as the strict version.
> Surprisingly, the strict version is a little bit *slower* than the
> regular strings version.
> Thanks for any comments or help!
> Justin

Also, be sure to compare against a naive search, optimised for
strict and lazy bytestrings,


If its not faster than those 2, then you're doing something wrong :)

-- Don

More information about the Haskell-Cafe mailing list