Subject: Re: [PATCH] git gc: Speed it up by 18% via faster hash comparisons

From: "H. Peter Anvin" <[email-masked]>
Date: Thu, 28 Apr 2011 13:19:04 -0700

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