bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linus' sha1 is much faster!


From: Steven Noonan
Subject: Re: Linus' sha1 is much faster!
Date: Mon, 17 Aug 2009 08:44:30 -0700

On Mon, Aug 17, 2009 at 3:51 AM, Giuseppe Scrivano<address@hidden> wrote:
> Pádraig Brady <address@hidden> 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

Interesting. I compared Linus' implementation to the public domain one
by Steve Reid[1], which is used in OpenLDAP and a few other projects.
Anyone with some experience testing these kinds of things in a
statistically sound manner want to try it out? In my tests, I got
this:

(average of 5 runs)
Linus' sha1: 283MB/s
Steve Reid's sha1: 305MB/s

- Steven

[1] 
http://gpl.nas-central.org/SYNOLOGY/x07-series/514_UNTARED/source/openldap-2.3.11/libraries/liblutil/sha1.c




reply via email to

[Prev in Thread] Current Thread [Next in Thread]