Subject: Re: Linus' sha1 is much faster!

From: Giuseppe Scrivano <[email-masked]>
Date: Mon, 17 Aug 2009 12:51:17 +0200

Pádraig Brady <[email-masked]> writes:

>   -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
>   -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586
>   -mtune=generic -fasynchronous-unwind-tables -D_GNU_SOURCE=1

thanks.  I did again all tests on my machine using these same options.
I repeated each test 6 times and I took the median without consider the
first result.  Except the first run that it is not considered, I didn't
report a big variance on results of the same test.

gcc 4.3.3

gnulib sha1:            real	0m2.543s
gnulib sha1 lookup:     real	0m1.906s (-25%)
linus's sha1:           real	0m2.468s (-3%)
linus's sha1 no asm:    real	0m2.289s (-9%)

gcc 4.4.1

gnulib sha1:            real	0m3.386s
gnulib sha1 lookup:     real	0m3.110s (-8%)
linus's sha1:           real	0m1.701s (-49%)
linus's sha1 no asm:    real	0m1.284s (-62%)

I don't see such big differences in asm generated by gcc 4.4.1 and gcc
4.3.3 to explain this performance difference, what I noticed immediately
is that in the gcc-4.4 generated asm there are more "lea" instructions
(+30%), but I doubt this is the reason of these poor results.  Anyway, I
haven't yet looked much in details.

Cheers,
Giuseppe