Re: [PATCH 1/2] fast-import: use struct hash_table for atom strings
From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:57
Jonathan Nieder wrote:
quoted
@@ -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.