git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.
Previous: Jonathan NiederNext: David Barr
Message 4 of 13 in “fast-import: use struct hash_table”
  1. David BarrMar 31, 2011
  2. 1/2 fast-import: use struct hash_table for atom stringsDavid Barr, Mar 31, 2011
  3. Jonathan NiederApr 2, 2011
  4. Jonathan NiederApr 2, 2011
  5. 2/2 fast-import: use struct hash_table for objectsDavid Barr, Mar 31, 2011
  6. Jonathan NiederApr 2, 2011
  7. Jonathan NiederApr 2, 2011
  8. 0/4 Re: fast-import: use struct hash_tableJonathan Nieder, Apr 11, 2012
  9. 0/4 Re: fast-import: use struct hash_tableJonathan Nieder, Apr 11, 2012
  10. 1/4 fast-import: allow object_table to grow dynamicallyJonathan Nieder, Apr 11, 2012
  11. 2/4 fast-import: allow atom_table to grow dynamicallyJonathan Nieder, Apr 11, 2012
  12. 3/4 fast-import: allow branch_table to grow dynamicallyJonathan Nieder, Apr 11, 2012
  13. 4/4 fast-import: use DIV_ROUND_UPJonathan Nieder, Apr 11, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.