Re: Preferring shallower deltas on repack
On Mon, 9 Jul 2007, Brian Downing wrote:
Show 45 quoted lines
> On Mon, Jul 09, 2007 at 02:24:03PM -0500, Brian Downing wrote:
> > No, I didn't try it on top of mine; sorry. I'll try that out.
>
> The results with both your patch and mine are exactly the same as
> yours applied to master (c956395e). The only thing mine adds on top of
> yours is:
>
> diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
> index 9a33698..2da78b4 100644
> --- a/builtin-pack-objects.c
> +++ b/builtin-pack-objects.c
> @@ -1373,6 +1373,12 @@ static int try_delta(struct unpacked *trg, struct unpacke
> return 0;
>
> if (trg_entry->delta_data) {
> + /* Prefer only shallower same-sized deltas. */
> + if (delta_size == trg_entry->delta_size &&
> + src_entry->depth + 1 >= trg_entry->depth) {
> + free(delta_buf);
> + return 0;
> + }
> delta_cache_size -= trg_entry->delta_size;
> free(trg_entry->delta_data);
> }
>
> Which was meant to pick off the cases where I got an equivalently
> sized patch that was as deep or deeper. This was neccessary due to
> my changing:
>
> --- a/builtin-pack-objects.c
> +++ b/builtin-pack-objects.c
> @@ -1337,7 +1337,7 @@ static int try_delta(struct unpacked *trg, struct unpacked
> if (max_size == 0)
> return 0;
> if (trg_entry->delta && trg_entry->delta_size <= max_size)
> - max_size = trg_entry->delta_size-1;
> + max_size = trg_entry->delta_size;
> src_size = src_entry->size;
> sizediff = src_size < trg_size ? trg_size - src_size : 0;
> if (sizediff >= max_size)
>
> max_size = trg_entry->delta_size;
>
> Your patch changed the max_size selection logic, so I'm not sure the
> rest of mine will do anything anymore.It is still valid nevertheless.
Nicolas