[Haskell-cafe] Performance: MD5

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat May 17 11:52:17 EDT 2008

Hello Andrew,

Saturday, May 17, 2008, 6:51:27 PM, you wrote:

> If anybody has any interesting insights as to why my version is so
> damned slow, I'd like to hear them.

i equally will be interesting to hear why you think what your program
should be as fast as C version? you wrote it in purely functional
style. as Don wrote, if you want to reach unoptimized C-like
performance, you need to write in C style - with explicit loop
processing primitive types. so

1) -funbox-strict-fields
2) don't use tuples as arguments - they are lazy. you may implement
strict tuples instead
3) function as a parameter is very bad unless it will be inlined

but these are only half-decisions. if you need maximum efficiency,
drop all this high-level code and map md5.c to haskell as it was done
in Don's bloag

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com

More information about the Haskell-Cafe mailing list