Re: [PATCH] git gc: Speed it up by 18% via faster hash comparisons
- From
- H. Peter Anvin <hpa@zytor.com>
- Date
- Apr 28, 2011, 20:19 UTC
- Message-ID
- <4DB9CBB8.8050605@zytor.com>
- In-Reply-To
- <BANLkTikU3evfo86WmQeVS_Z41s3xSK1DJw@mail.gmail.com>
On 04/28/2011 02:55 AM, Erik Faye-Lund wrote:
> > I disagree. We have no guarantee that the SHA-1s are aligned on x86 > either, and unaligned accesses are slow on x86. >
Not particularly, especially not statistically. Furthermore, for a sizable chunk like a SHA-1, not all accesses will have the cross-grain penalities that you sometimes can have.
> I think it's much much cleaner to add an early-out on the first byte, > and hope that memcmp is optimized properly. If it's not, those > platforms can add an override to memcmp in git-compat-util and/or > compat/*.
Overall, doing an architecture optimization library especially for widely used architectures like x86 is not a bad idea.
-hpa