[Haskell-cafe] Performance Help

Ian Lynagh igloo at earth.li
Fri Mar 16 17:24:22 EDT 2007

On Sun, Mar 11, 2007 at 08:18:44PM +0000, Dominic Steinitz wrote:
> I have re-written the sha1 code so that it is (hopefully) easy to see that it 
> faithfully implements the algorithm (see 
> http://www.itl.nist.gov/fipspubs/fip180-1.htm). Having got rid of the space 
> leak, I have been trying to improve performance.
> Currently, the haskell code is 2 orders of magnitude slower than the sha1sum 
> that ships with my linux.

I don't know if this is useful to you, but darcs has some SHA1 code that
IIRC is much closer to C's performance. It currently uses darcs' own
FastPackedString library, but porting it to ByteString should be fairly

See SHA1.lhs in http://www.abridgegame.org/repos/darcs-unstable

It might even be able to be made faster still by calling lower-level
functions than {shift,rotate}{L,R} directly.


More information about the Haskell-Cafe mailing list