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

Re: x86 SHA1: Faster than OpenSSL

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 4, 2009, 02:30 UTC
Message-ID
<alpine.LFD.2.01.0908031924230.3270@localhost.localdomain>
In-Reply-To
<20090803034741.23415.qmail@science.horizon.com>
On Sun, 2 Aug 2009, George Spelvin wrote:
Show 13 quoted lines
> 
> The original code was excellent, but it was optimized when the P4 was new.
> After a bit of tweaking, I've inflicted a slight (1.4%) slowdown on the
> P4, but a small-but-noticeable speedup on a variety of other processors.
> 
> Before      After       Gain    Processor
> 1.585248    1.353314	+17%	2500 MHz Phenom
> 3.249614    3.295619	-1.4%	1594 MHz P4
> 1.414512    1.352843	+4.5%	2.66 GHz i7
> 3.460635    3.284221	+5.4%	1596 MHz Athlon XP
> 4.077993    3.891826	+4.8%	1144 MHz Athlon
> 1.912161    1.623212	+17%	2100 MHz Athlon 64 X2
> 2.956432    2.940210	+0.55%	1794 MHz Mobile Celeron (fam 15 model 2)

It would be better to have a more git-centric benchmark that actually shows some real git load, rather than a sha1-only microbenchmark.

The thing that I'd prefer is simply
	git fsck --full

on the Linux kernel archive. For me (with a fast machine), it takes about 4m30s with the OpenSSL SHA1, and takes 6m40s with the Mozilla SHA1 (ie using a NO_OPENSSL=1 build).

So that's an example of a load that is actually very sensitive to SHA1 performance (more so than _most_ git loads, I suspect), and at the same time is a real git load rather than some SHA1-only microbenchmark. It also shows very clearly why we default to the OpenSSL version over the Mozilla one.

NOTE! I didn't do multiple runs to see how stable the numbers are, and so it's possible that I exaggerated the OpenSSL advantage over the Mozilla-SHA1 code. Or vice versa. My point is really only that I don't know how meaningful a "50 x 1M SHA1" benchmark is, while I know that a "git fsck" benchmark has at least _some_ real life value.

		Linus
Previous: Mark LodatoNext: Linus Torvalds
Message 22 of 60 in “Re: Performance issue of 'git branch'”
  1. George SpelvinJul 26, 2009
  2. Request for benchmarking: x86 SHA1 codeGeorge Spelvin, Jul 31, 2009
  3. Erik Faye-LundJul 31, 2009
  4. George SpelvinJul 31, 2009
  5. Michael J GruberJul 31, 2009
  6. Erik Faye-LundJul 31, 2009
  7. Johannes SchindelinJul 31, 2009
  8. George SpelvinJul 31, 2009
  9. Erik Faye-LundJul 31, 2009
  10. George SpelvinJul 31, 2009
  11. Michael J GruberJul 31, 2009
  12. Michael J GruberJul 31, 2009
  13. Carlos R. MafraJul 31, 2009
  14. Brian RistucciaJul 31, 2009
  15. George SpelvinJul 31, 2009
  16. Jakub NarebskiJul 31, 2009
  17. Peter HarrisJul 31, 2009
  18. Peter HarrisJul 31, 2009
  19. x86 SHA1: Faster than OpenSSLGeorge Spelvin, Aug 3, 2009
  20. Jonathan del StrotherAug 3, 2009
  21. Mark LodatoAug 4, 2009
  22. Linus TorvaldsAug 4, 2009
  23. Linus TorvaldsAug 4, 2009
  24. Jon SmirlAug 4, 2009
  25. George SpelvinAug 4, 2009
  26. Jon SmirlAug 4, 2009
  27. Dmitry PotapovAug 4, 2009
  28. Andy PolyakovAug 18, 2009
  29. George SpelvinAug 4, 2009
  30. Linus TorvaldsAug 4, 2009
  31. George SpelvinAug 4, 2009
  32. Junio C HamanoAug 4, 2009
  33. George SpelvinAug 5, 2009
  34. Johannes SchindelinAug 5, 2009
  35. Junio C HamanoAug 5, 2009
  36. Linus TorvaldsAug 5, 2009
  37. Linus TorvaldsAug 5, 2009
  38. Linus TorvaldsAug 6, 2009
  39. Nicolas PitreAug 6, 2009
  40. Junio C HamanoAug 6, 2009
  41. Linus TorvaldsAug 6, 2009
  42. Nicolas PitreAug 6, 2009
  43. Linus TorvaldsAug 6, 2009
  44. Artur SkawinaAug 6, 2009
  45. Linus TorvaldsAug 6, 2009
  46. Linus TorvaldsAug 6, 2009
  47. Linus TorvaldsAug 6, 2009
  48. Artur SkawinaAug 6, 2009
  49. Linus TorvaldsAug 6, 2009
  50. Artur SkawinaAug 6, 2009
  51. George SpelvinAug 6, 2009
  52. George SpelvinAug 6, 2009
  53. Artur SkawinaAug 6, 2009
  54. Linus TorvaldsAug 6, 2009
  55. Artur SkawinaAug 6, 2009
  56. Artur SkawinaAug 6, 2009
  57. Artur SkawinaAug 6, 2009
  58. Erik Faye-LundAug 6, 2009
  59. Linus TorvaldsAug 4, 2009
  60. Andy PolyakovAug 18, 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.