Subject: Re: [BUG] Performance regression due to #33d4221: write_sha1_file: freshen existing objects

From: Jeff King <[email-masked]>
Date: Mon, 20 Apr 2015 15:53:38 -0400

On Sat, Apr 18, 2015 at 01:35:51PM +1000, Stefan Saasen wrote:

> Here are the timings for the two patches:
> [...]

Thanks, that matches what I was hoping for.

> My tweaked version of your second patch is:
> [...]
> -       return find_pack_entry(sha1, &e) && freshen_file(e.p->pack_name);
> +       if (!find_pack_entry(sha1, &e))
> +              return 0;
> +       if (e.p->freshened)
> +              return 1;
> +       return e.p->freshened = freshen_file(e.p->pack_name);
>  }

Whooops, yeah, setting the flag is probably helpful. :)

We usually try to avoid assignments in a return like this, so I've
written it out a little more verbosely in my final version. I'll send
those patches in a moment.

  [1/2]: sha1_file: freshen pack objects before loose
  [2/2]: sha1_file: only freshen packs once per run

> Is there a chance to backport those changes to the 2.2+ branches?

That's up to Junio. These patches can be applied straight to the
jk/prune-mtime topic. Usually he would then merge the topic up to
"maint", which at this would potentially become the next v2.3.x. If an
issue is critical (e.g., a security vulnerability), he'll sometimes
merge and roll maintenance releases for older versions. But I don't know
if this counts as critical (it is for you, certainly, but I don't think
that many people are affected, as the crucial factor here is really the
slow NFS filesystem operations).

-Peff