Re: [PATCH] git gc: Speed it up by 18% via faster hash comparisons
- From
- H. Peter Anvin <hpa@zytor.com>
- Date
- Apr 29, 2011, 16:24 UTC
- Message-ID
- <4DBAE628.4080501@zytor.com>
- In-Reply-To
- <BANLkTikt0CU87maPs65WGi0oopD+g0uVDA@mail.gmail.com>
On 04/29/2011 12:05 AM, Alex Riesen wrote:
Show 7 quoted lines
> > Can one take advantage of common expression optimization here? > Like this: > > + if (*sha1 - *sha2) > + return *sha1 - *sha2; >
Or even clue the compiler in explicitly:
delta = *sha1 - *sha2; if (delta) return delta;
For newer x86-specific optimization there are a bunch of newer SSE instructions which can be used to do bulk compares which may be faster if optimized for the fixed length compare; of course it requires a new enough processor.
-hpa
-- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.