Re: [PATCH v2 0/3] receive-pack: only use visible refs for connectivity check
- From
Jeff King <peff@peff.net>
- Date
- Nov 5, 2022, 12:52 UTC
- Message-ID
- <Y2Zci0z39Q0/sMHY@coredump.intra.peff.net>
- In-Reply-To
- <cover.1667485737.git.ps@pks.im>
On Thu, Nov 03, 2022 at 03:37:25PM +0100, Patrick Steinhardt wrote:
> Overall the performance improvement isn't quite as strong as before: > we're only 4.5x faster compared to 6.5x in our repo. But I guess that's > still a good-enough improvement, doubly so that there are no downsides > for repos anymore that ain't got any hidden refs.
Just a guess, but the extra time is probably spent because "rev-list" has to iterate over your kajillion refs saying "nope, not this one".
I wonder if there is a way to carve up the ref namespace early, in a trie-like way, similar to how for_each_fullref_in_prefixes() skips straight to the interesting part. It's a harder problem, because we are excluding rather than including entries based on our patterns. But it seems like you'd be able to notice that we are on "refs/foo/bar", that all of "refs/foo" is excluded, and jump ahead to the end of the "refs/foo" section by binary-searching for the end within the packed-refs file.
And that would speed up both this rev-list, but also the initial advertisement that receive-pack does, because it's also iterating all of these saying "nope, it's hidden". And assuming these are all internal refs you hide from users, upload-pack would benefit, too.
I don't think that should be part of this series, but it may be an interesting future direction.
-Peff