SHA1
John Tapsell
johnflux at gmail.com
Thu Aug 6 02:17:12 PDT 2009
Hi all,
There is a long conversation going on on the git mailing list over
SHA1 implementations, and in particular measuring them in 'real world'
situations. Since xorg also relies on a fast SHA1 implementation for
comparing pixmaps, I think you'll find the results interesting.
I have summarised the results below for your convenience.
I was particularly amazed at just how much of a difference there is
between implementations.
These results are from running "git fsck -a" on the linux kernel and
so represent "real" world situations.
These are the results that Linus Torvalds got on x86-64:
- Mozilla SHA1 portable C-code (sucky sucky): MOZILLA_SHA1=1
real 0m38.194s
user 0m37.838s
sys 0m0.356s
- The SHA1 implementation used by git ("half-portable C code"): BLK_SHA1=1
real 0m28.120s
user 0m27.930s
sys 0m0.192s
- OpenSSL assembler code:
real 0m26.327s
user 0m26.194s
sys 0m0.136s
And on 32 bit we see GCC clearly struggling with register starvation:
- Mozilla SHA:
real 0m47.063s
user 0m46.815s
sys 0m0.252s
- BLK_SHA1=1
real 0m34.705s
user 0m34.394s
sys 0m0.312s
- OPENSSL:
real 0m29.754s
user 0m29.446s
sys 0m0.288s
Encouraged by the fact that the git implementation is almost as good
as the ASM, Linus then started to tweak the C code with the most evil
and foul code that I've seen. The end result was (on 64-bit)
- OpenSSL:
real 0m26.363s
user 0m26.174s
sys 0m0.188s
- This C implementation:
real 0m26.594s
user 0m26.310s
sys 0m0.256s
And on a slow 32bit atom (with the evil-and-foul changes they made):
- BLK_SHA1:
real 2m27.160s
user 2m23.651s
sys 0m2.392s
- OpenSSL:
real 2m12.580s
user 2m9.998s
sys 0m1.811s
John
More information about the xorg
mailing list