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

Re: [PATCH 6/9] Use uint32_t for pack-objects counters.

From
Junio C Hamano <junkio@cox.net>
Date
Mar 7, 2007, 19:02 UTC
Message-ID
<7v1wk0g9mp.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070307014424.GG26482@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 37 quoted lines
> No logic change should be occuring here, with the exception that
> some comparsions will now work properly when the number of objects
> exceeds 2**31-1.
> ...
>  static void find_deltas(struct object_entry **list, int window, int depth)
>  {
> -	int i, idx;
> +	uint32_t i = nr_objects, idx = 0, processed = 0;
>  	unsigned int array_size = window * sizeof(struct unpacked);
> -	struct unpacked *array = xmalloc(array_size);
> -	unsigned processed = 0;
> +	struct unpacked *array;
>  	unsigned last_percent = 999;
>  
> +	if (!nr_objects)
> +		return;
> +	array = xmalloc(array_size);
>  	memset(array, 0, array_size);
> -	i = nr_objects;
> -	idx = 0;
>  	if (progress)
> -		fprintf(stderr, "Deltifying %d objects.\n", nr_result);
> +		fprintf(stderr, "Deltifying %u objects.\n", nr_result);
>  
> -	while (--i >= 0) {
> -		struct object_entry *entry = list[i];
> +	do {
> +		struct object_entry *entry = list[--i];
>  		struct unpacked *n = array + idx;
>  		int j;
> ...  
> @@ -1345,7 +1342,7 @@ static void find_deltas(struct object_entry **list, int window, int depth)
>  		idx++;
>  		if (idx >= window)
>  			idx = 0;
> -	}
> +	} while (i > 0);

I may not be reading the patch correctly, but doesn't this make find_deltas() logic to scan the list backwards? We sort the list by type and size before we enter this, so that we scan from bigger to smaller, because we prefer to leave biggest as a base and represent smaller ones as deltas (removing deltas do not have to record preimage and tend to be much smaller than adding deltas). I suspect this change may affect that optimization.

Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 2 of 4 in “Use uint32_t for pack-objects counters.”
  1. 6/9 Use uint32_t for pack-objects counters.Shawn O. Pearce, Mar 7, 2007
  2. Junio C HamanoMar 7, 2007
  3. Shawn O. PearceMar 7, 2007
  4. Junio C HamanoMar 7, 2007

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.