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

Re: [PATCH] rev-list: preallocate object hash table in --all --objects

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 29, 2013, 16:04 UTC
Message-ID
<7vsj3ep4zn.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130329151208.GA22744@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 21 quoted lines
> This feels weirdly specific, and like we should just be tuning our hash
> table growth better. You show a 3.2% speedup here. I was able to get a
> 2.8% speedup just by doing this:
>
> diff --git a/object.c b/object.c
> index 20703f5..8e5e12c 100644
> --- a/object.c
> +++ b/object.c
> @@ -91,7 +91,7 @@ static void grow_object_hash(void)
>  static void grow_object_hash(void)
>  {
>  	int i;
> -	int new_hash_size = obj_hash_size < 32 ? 32 : 2 * obj_hash_size;
> +	int new_hash_size = obj_hash_size < 32 ? 32 : 3 * obj_hash_size;
>  	struct object **new_hash;
>  
>  	new_hash = xcalloc(new_hash_size, sizeof(struct object *));
>
> It might be worth trying to figure out what the optimium growth rate is
> first, which would help this use case and others. With less fragile
> code.

I agree with the general principle to avoid heuristics that is too specific to the use case. Thanks.

Previous: Jeff King
Message 6 of 6 in “rev-list: preallocate object hash table in --all --objects”
  1. rev-list: preallocate object hash table in --all --objectsNguyễn Thái Ngọc Duy, Mar 29, 2013
  2. Jeff KingMar 29, 2013
  3. Duy NguyenMar 29, 2013
  4. Jeff KingMar 29, 2013
  5. Jeff KingApr 1, 2013
  6. Junio C HamanoMar 29, 2013

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.