Re: [PATCH] pack-objects: avoid pointless oe_map_new_pack() calls
- From
Jeff King <peff@peff.net>
- Date
- Nov 11, 2019, 14:28 UTC
- Message-ID
- <20191111142800.GA1934@sigill.intra.peff.net>
- In-Reply-To
- <01605e2d-5ea7-037d-b25f-3774b88d059d@gmail.com>
On Mon, Nov 11, 2019 at 08:42:47AM -0500, Derrick Stolee wrote:
Show 10 quoted lines
> > The current test in p5303 sadly doesn't notice this problem, since it > > maxes out at 1000 packs. If we add a new test to it at 2000 packs, it > > does show the improvement: > > > > Test HEAD^ HEAD > > ---------------------------------------------------------------------- > > 5303.12: repack (2000) 26.72(39.68+0.67) 15.70(28.70+0.66) -41.2% > > And these numbers don't really show a quadratic improvement, probably due > to the test itself needing to do the work to create 2000 packs.
No, the 2000-pack setup happens in a separate (untimed) test.
The reason this improvement is less extreme is that we're only hitting the extra oe_map_new_pack() call for a subset of the objects. The first 1023 packs have an index field (and because of the way we generate the packs, I think that includes the "big" initial pack), so not every object triggers the problem.
This was spurred by a couple of real cases where maintenance had fallen behind and we had accrued a lot of packs (and of course we wanted to repack to get out of the bad situation, which became a chicken and egg). One of those real-world cases with 15,000 packs dropped from ~11 hours to ~5 minutes.
I'm actually amazed we didn't notice this before (the problem started in v2.18, which we deployed at GitHub over a year ago). But we try to avoid ending up with that many packs in the first place, and even when we did, automated maintenance _usually_ dug them out by itself if you were patient enough.
> Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
Thanks!
-Peff