[Haskell-cafe] MD5? (was: Haskell performance question)

Don Stewart dons at galois.com
Thu Nov 8 18:12:43 EST 2007

> Don Stewart wrote:
> >dpiponi:
> >  
> >>I was getting about 1.5s for the Haskell program and about 0.08s for
> >>the C one with the same n=10,000,000.
> >>    
> >
> >I'm sure we can do better than that!
> >  
> That's the spirit! :-D
> Speaking of which [yes, I'm going to totally hijack this thread now...], 
> does anybody have a Haskell MD5 hash implementation that goes fast? 
> IIRC, I found one in MissingH, and it worked great. Except that as soon 
> as you feed it a 10 MB file, the standard Unix "md5sum" executable takes 
> about 0.001s to do it, and the Haskell version goes crazy and starts 
> eating virtual memory like candy. o_O (Although given a few minutes it 
> *does* produce the correct answer. But given that I want to run it over 
> an entire CD......)
> Given the choise, I'd *like* to find a fast 100% Haskell implementation 
> - but failing that, (nice) bindings to a fast C implementation will do I 
> guess. (I *only* need to compute MD5 hashes for files on disk. I don't 
> need to do anything more fancy than that...)

Start with a fast C version, and translate that into code over
ByteStrings. If its not within 2x, call the bytestring hackers hotline,
which is on the wiki.

-- Don

More information about the Haskell-Cafe mailing list