git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Linus' sha1 is much faster!

From
Pádraig Brady <p@draigbrady.com>
Date
Aug 17, 2009, 01:53 UTC
Message-ID
<4A88B80D.40804@draigBrady.com>
In-Reply-To
<87eirbef3c.fsf@master.homenet>
Giuseppe Scrivano wrote:
Show 13 quoted lines
> Hi Pádraig,
> 
> I tried to reproduce your results but I wasn't able to do it.  The
> biggest difference on a 300MB file I noticed was approximately 15% using
> on both implementations -O2, and 5% using -O3.
> My GCC version is "gcc (Debian 4.3.3-14) 4.3.3" and the CPU is: Intel(R)
> Pentium(R) D CPU 3.20GHz.
> 
> I also spent some time trying to improve the gnulib SHA1 implementation
> and it seems a lookup table can improve things a bit.
> 
> Can you please try the patch that I have attached and tell me which
> performance difference (if any) you get?

Thanks for looking at this Giuseppe and sorry for not mentioning my GCC and CPU.

Note the binaries below is compiled with $(rpm -q --qf="%{OPTFLAGS}\n" coreutils) for consistency, which on my F11 machines is:

  -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
Testing on 2 machines I have here:

$ rpm -q gcc gcc-4.4.1-2.fc11.i586 $ grep "model name" /proc/cpuinfo | head -n1 | tr -s '[:blank:]' ' ' model name : Intel(R) Pentium(R) M processor 1.70GHz $ truncate -s300MB sha1.test $ time sha1sum sha1.test real 0m3.540s $ time linus-sha1 sha1.test real 0m2.319s (-34%) $ time giuseppe-sha1sum sha1.test real 0m3.513s (-.8%)

$ rpm -q gcc gcc-4.4.1-2.fc11.i586 $ grep "model name" /proc/cpuinfo | head -n1 | tr -s '[:blank:]' ' ' model name : Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz $ truncate -s300MB sha1.test $ time sha1sum sha1.test real 0m1.857s $ time linus-sha1 sha1.test real 0m1.102s (-40%) $ time giuseppe-sha1sum sha1.test real 0m1.932s (+ 4%)

cheers, Pádraig.

Previous: Linus TorvaldsNext: Giuseppe Scrivano
Message 16 of 21 in “Linus' sha1 is much faster!”
  1. Pádraig BradyAug 14, 2009
  2. Bryan DonlanAug 15, 2009
  3. John TapsellAug 15, 2009
  4. Linus TorvaldsAug 15, 2009
  5. Linus TorvaldsAug 15, 2009
  6. Nicolas PitreAug 17, 2009
  7. Pádraig BradyAug 26, 2009
  8. galtApr 20, 2017
  9. galtApr 20, 2017
  10. Andreas EricssonAug 17, 2009
  11. Theodore TsoAug 16, 2009
  12. Giuseppe ScrivanoAug 16, 2009
  13. Linus TorvaldsAug 16, 2009
  14. Giuseppe ScrivanoAug 16, 2009
  15. Linus TorvaldsAug 16, 2009
  16. Pádraig BradyAug 17, 2009
  17. Giuseppe ScrivanoAug 17, 2009
  18. Steven NoonanAug 17, 2009
  19. Linus TorvaldsAug 17, 2009
  20. Steven NoonanAug 17, 2009
  21. Giuseppe ScrivanoAug 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.