Eliminate Gitaly N+1 queries loading submodules
When a directory contains many submodules, we make a number of Gitaly N+1 queries:
- One TreeEntry RPC to look up each submodule
- One TreeEntry RPC to read the
.gitmodules
file
The first item is redundant because we've already determined the tree commit is a submodule. We can eliminate this query by skipping it altogether.
The second item can be optimized by caching the contents of
.gitmodules
once per directory. We already have a mechanism for
caching this in SubmoduleLinks
. Now we just need to use it.
This significantly reduces Gitaly RPCs and closes THREE issues with one stone:
Edited by Stan Hu