[Haskell-cafe] Substring replacements

Bulat Ziganshin bulatz at HotPOP.com
Tue Dec 20 15:55:22 EST 2005

Hello Branimir,

Tuesday, December 20, 2005, 9:48:48 PM, you wrote:

BM> I've finally performed test on amd64 and result is a same as on intel.
BM> KMP always wins. So KMP is best suited for non indexed strings
BM> and I guess should be used in library as prefered search/replace method.
BM> This test favors straightforward search.

i'm 90% sure that straightforward method must be faster for one-time
searches. your test may give better results with KMP algorithm just
because you repeat the same search many times and it was automatically
"run-time compiled" as described on the wiki page about KMP

try to add

{-# NOINLINE replace #-}

to both programs and repeat comparision

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell-Cafe mailing list