[Haskell-cafe] Optimizing a hash function
isto
isto.aho at dnainternet.net
Sun Nov 26 08:04:38 EST 2006
su, 2006-11-26 kello 15:12 +1100, Ivan Tomac kirjoitti:
> The first version I came up with ran 20 times slower than C.
> Thanks to Don Stewart's suggestions on IRC, I managed to improve the
> ...
> Options used to compile the version using the hash function written
> in Haskell:
> ghc -O -funbox-strict-fields -fglasgow-exts -fbang-patterns -cpp -o
> test hashByteString.hs test.hs
>
> Options used to compile the version using the hash function in C:
> ghc -O -fglasgow-exts -ffi -fbang-patterns -cpp -DCHASH -o ctest
> ctest.c test.hs
Hi Ivan Tomac,
Have you tried -O3 -optc-O3 -funfolding-use-threshold=16
compile flags? Don, Lemmih, Lennart and Bulat helped me to sort
out a similar problem a couple of weeks ago. More hints can be found at
http://haskell.org/haskellwiki/Performance/GHC
Especially, to check generated code by taking a look of core
-ddump-simpl > core.txt
and to check memory leaks, you could run with
+RTS -sstderr
br, Isto
More information about the Haskell-Cafe
mailing list