git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Pearce <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Nicolas Pitre <nico@cam.org>, git@vger.kernel.org
Subject: Re: 1.3.0 creating bigger packs than 1.2.3
Date: Thu, 20 Apr 2006 21:01:46 -0400	[thread overview]
Message-ID: <20060421010146.GA819@spearce.org> (raw)
In-Reply-To: <7vy7xzvpsg.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
[snip]
> I suspect the test patch makes pack-objects a lot more
> expensive.

Which patch are you talking about the previous patch or the one in
the message I'm now replying to?

> The code before the test patch said "if the size is very small
> or size difference is too great, do not consider this, and do
> not consider any more objects in the delta window, because we
> know they are either even smaller of the same path, they have
> different names, or they are of different type".  The test patch
> you tried was a quick and dirty hack that said "under the
> too-small condition, skip this one, but keep trying the rest of
> the delta window".
> 
> Here is a cleaned up patch.  What it does is "under the
> too-small condition, see if the object has the same basename,
> and if so keep going, but otherwise skip the rest as before".
[snip]

The patch below does not help very much:

  Total 46391, written 46391 (delta 6686), reused 37979 (delta 0)
  129M pack-7f766f5af5547554bacb28c0294bd562589dc5e7.pack

> diff --git a/pack-objects.c b/pack-objects.c
> index 09f4f2c..2173709 100644
> --- a/pack-objects.c
> +++ b/pack-objects.c
> @@ -1036,8 +1036,6 @@ static int try_delta(struct unpacked *cu
>  	oldsize = old_entry->size;
>  	sizediff = oldsize > size ? oldsize - size : size - oldsize;
>  
> -	if (size < 50)
> -		return -1;
>  	if (old_entry->depth >= max_depth)
>  		return 0;
>  
> @@ -1048,20 +1046,27 @@ static int try_delta(struct unpacked *cu
>  	 * more space-efficient (deletes don't have to say _what_ they
>  	 * delete).
>  	 */
> -	max_size = size / 2 - 20;
> -	if (cur_entry->delta)
> -		max_size = cur_entry->delta_size-1;
> -	if (sizediff >= max_size)
> -		return -1;
> -	delta_buf = diff_delta(old->data, oldsize,
> -			       cur->data, size, &delta_size, max_size);
> -	if (!delta_buf)
> +	if (50 <= size) {
> +		max_size = size / 2 - 20;
> +		if (cur_entry->delta)
> +			max_size = cur_entry->delta_size-1;
> +		if (sizediff < max_size) {
> +			delta_buf = diff_delta(old->data, oldsize,
> +					       cur->data, size,
> +					       &delta_size, max_size);
> +			if (!delta_buf)
> +				return 0;
> +			cur_entry->delta = old_entry;
> +			cur_entry->delta_size = delta_size;
> +			cur_entry->depth = old_entry->depth + 1;
> +			free(delta_buf);
> +			return 0;
> +		}
> +	}
> +	/* Keep going as long as the basename matches */
> +	if (((cur_entry->hash ^ old_entry->hash) >>DIRBITS) == 0)
>  		return 0;
> -	cur_entry->delta = old_entry;
> -	cur_entry->delta_size = delta_size;
> -	cur_entry->depth = old_entry->depth + 1;
> -	free(delta_buf);
> -	return 0;
> +	return -1;
>  }
>  
>  static void progress_interval(int signum)
> 

-- 
Shawn.

  reply	other threads:[~2006-04-21  1:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20 13:36 1.3.0 creating bigger packs than 1.2.3 Shawn Pearce
2006-04-20 14:47 ` Linus Torvalds
2006-04-20 15:03   ` Shawn Pearce
2006-04-20 16:07     ` Linus Torvalds
2006-04-20 16:43       ` Shawn Pearce
2006-04-20 17:03         ` Linus Torvalds
2006-04-20 17:24           ` Junio C Hamano
2006-04-20 17:31           ` Shawn Pearce
2006-04-20 17:54             ` Nicolas Pitre
2006-04-20 21:31             ` Junio C Hamano
2006-04-20 21:53               ` Shawn Pearce
2006-04-20 21:56               ` Jakub Narebski
2006-04-20 17:41           ` Nicolas Pitre
2006-04-20 17:55           ` Shawn Pearce
2006-04-20 18:24             ` Nicolas Pitre
2006-04-20 18:49               ` Junio C Hamano
2006-04-20 21:02                 ` Nicolas Pitre
2006-04-20 21:40                   ` Junio C Hamano
2006-04-20 22:02                     ` Shawn Pearce
2006-04-20 22:35                       ` Junio C Hamano
2006-04-21  1:01                         ` Shawn Pearce [this message]
2006-04-20 22:59                       ` Linus Torvalds
2006-04-21  0:52                     ` Nicolas Pitre
2006-04-21  1:20                     ` Shawn Pearce
2006-04-21  2:28                       ` Nicolas Pitre
2006-04-21  2:40                         ` Shawn Pearce
2006-04-21  3:07                           ` Nicolas Pitre
2006-04-21  2:32                       ` Shawn Pearce
2006-04-20 23:02                   ` Junio C Hamano
2006-04-20 16:09 ` Nicolas Pitre

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=20060421010146.GA819@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=nico@cam.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;
as well as URLs for NNTP newsgroup(s).