Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 6/9] Use uint32_t for pack-objects counters.
Date: Wed, 07 Mar 2007 11:02:22 -0800	[thread overview]
Message-ID: <7v1wk0g9mp.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070307014424.GG26482@spearce.org> (Shawn O. Pearce's message of "Tue, 6 Mar 2007 20:44:24 -0500")

"Shawn O. Pearce" <spearce@spearce.org> writes:

> 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.

  reply	other threads:[~2007-03-07 19:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07  1:44 [PATCH 6/9] Use uint32_t for pack-objects counters Shawn O. Pearce
2007-03-07 19:02 ` Junio C Hamano [this message]
2007-03-07 20:37   ` Shawn O. Pearce
2007-03-07 21:52     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v1wk0g9mp.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox