Re: [PATCH 1/2] fast-import: use struct hash_table for atom strings
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Apr 2, 2011, 03:33 UTC
- Message-ID
- <20110402033321.GA7023@elie>
- In-Reply-To
- <20110402024209.GA6039@elie>
Jonathan Nieder wrote:
Show 19 quoted lines
>> @@ -691,8 +691,12 @@ static struct atom_str *to_atom(const char *s, unsigned short len)
>> c->str_len = len;
>> strncpy(c->str_dat, s, len);
>> c->str_dat[len] = 0;
>> - c->next_atom = atom_table[hc];
>> - atom_table[hc] = c;
>> + c->next_atom = NULL;
>> + pos = insert_hash(hc, c, &atom_table);
>> + if (pos) {
>> + c->next_atom = *pos;
>> + *pos = c;
>> + }
>
> If I understand correctly, this puts new atoms at the start of the
> chain, just like v1.7.4-rc0~40^2 (fast-import: insert new object
> entries at start of hash bucket, 2010-11-23) did for objects. Did you
> measure and find this faster, or is it just for simplicity or
> consistency? (I'd personally be fine with it either way, but it seems
> prudent to ask.)Agh. Too-quick reading on my part (or rather, I lazily made an assumption and didn't pay much attention to the old code at all). I have no reason to believe inserting at the end of the bucket would be better, and it would certainly be more complex.
Sorry, folks. Don't mind me.