Re: git-status performance with submodules
- From
Jeff King <peff@peff.net>
- Date
- Dec 2, 2019, 14:05 UTC
- Message-ID
- <20191202140552.GB16534@sigill.intra.peff.net>
- In-Reply-To
- <xmqq5zizz0ei.fsf@gitster-ct.c.googlers.com>
On Sun, Dec 01, 2019 at 10:50:29PM -0800, Junio C Hamano wrote:
Show 10 quoted lines
> But the way "git status" code is structured, it probably takes a bit > of preparatory refactoring. If I recall correctly, it walks each > path in the index in the superproject and notes how the file in the > working tree is different from that of the index and the HEAD, under > the assumption that inspection of each path is relatively cheap and > at the same cost. You'd first need to restructure that part so that > inspecting groups of index entries can be sharded to separate > subprocesses while the parent process waits, and have them report to > the parent process, and let the parent process continue with the > aggregated result, or something like that.
There's some prior art for this approach in git-checkout, where we have a similar problem with latency of filters (e.g., for LFS). There the individual status for a path becomes a tri-state: success, error, or deferred. And then we collect the results from the deferred ones in a loop.
I think (but didn't look carefully) that this could be slotted into the diff code pretty easily. After the tree-level diff we have a queue of candidates in memory. At that point we should be able to kick off a process in parallel for each submodule, then wait for them all to finish before proceeding. Maybe even as a stage of diffcore_std(), but I'm not sure.
(Hand-wavey, I know, but just trying to point interested folks in the right direction).
-Peff