Re: [PATCH] Hold an 'unsigned long' chunk of the sha1 in obj_hash
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Apr 25, 2013, 21:12 UTC
- Message-ID
- <CACsJy8CJO+rLHgMo+F_fsWBj7Nm0rbpVNHTLXbi7u60+rT0OJQ@mail.gmail.com>
- In-Reply-To
- <6c2b67a2f0b67ee796c7676e3febe4c61ab85d4a.1366912627.git.trast@inf.ethz.ch>
On Fri, Apr 26, 2013 at 1:04 AM, Thomas Rast <trast@inf.ethz.ch> wrote:
Show 9 quoted lines
> So we take a slightly different approach, and trade some memory for > better cache locality. Namely, we change the hash table slots to > contain > > struct object *obj; > unsigned long sha1prefix; > > We use this new 'sha1prefix' field to store the first part of the > object's sha1, from which its hash table slot is computed.
Clever. I went a similar road before. But I put the whole 20-byte sha-1 in obj_hash, which makes obj_hash even bigger and less cache-friendly. -- Duy