[Haskell-cafe] Performance and STUArrays

Jean-Marie Gaillourdet jmg at informatik.uni-kl.de
Mon Apr 23 03:32:28 EDT 2007

Hi Dominic,

Dominic Steinitz wrote:
> I've been playing around some more trying improve the performance of the SHA1
> implmentation in the crypto library. I've isolated one of the functions and
> implemented it using
> a) unfold
> and
> b) STUArray
> The STUArray implementation is about twice as fast but I was expecting an
> order of magnitude improvement given I thought I would have been allocating
> 16 x 80 new 32 bit words with unfold but nothing with the STUArray.
> Should I have been disappointed?
> dom at heisenberg:~/sha12> time ./arrTest 17 STUArray > /dev/null
> real    0m11.102s
> user    0m9.129s
> sys     0m0.112s
> dom at heisenberg:~/sha12> time ./arrTest 17 Unfold > /dev/null
> real    0m18.381s
> user    0m16.361s
> sys     0m0.212s
> <code snipped>

I did not have time to look into your code yet. But the question whether
this is only a constant factor improvement or an implementation with a
different time complexity can only be researched by a series of
experiments with different input sizes. An interpretation of a series of
 results of experiments is more meaningful than just one data point.


More information about the Haskell-Cafe mailing list