index/index.js:271:Wt subRevs costs 25.5 s of a 73.4 s commit walk over git.git
(81726 commits) for ONE submodule: subTree misses once per commit (81656
times, 25.3 s) while the ODB reads themselves are 2.65 s — the JS cursor loop
re-parses the root tree into a second capped cache. Memoizing subAt and
pruning tree === pTree bought nothing (each commit's root tree is distinct).
:1125 also takes submodulePaths from the TIP only, so a submodule moved or
removed before the tip gets no dir revs, and every gap run re-walks the tip
tree for the .gitmodules gate (221 tree parses for a 1-commit catch-up).
Found in the 2026-09-18 index review.
Let git.getTreeDiff keep gitlinks (BEE-006:54:on is why it drops them) or add a
leaf answering one tree's gitlink at a path; else readTree keeps gitlinks in
its single parse. Gate the .gitmodules check on the tip's cached tree.
subTree reads the gitlinks off the RAW tree bytes, not the
git.tree cursor: that cursor mints a JS object and a
40-hex string PER ENTRY, while only a gitlink's mode starts
"16", so two byte compares reject the other 558 entries of
git.git's root tree. 3000 root trees: 1510 ms by cursor,
311 ms by scan, the ODB reads inside both some 300 ms..gitmodules (BEE-006:34:on
allows it) with the TREE as the authority: a named path is
kept only where subAt finds a real gitlink. A gap run
reads one blob instead of parsing all 226 dirs of git.git's
tip tree: 6.0 ms -> 1.1 ms per enumeration..gitmodules re-reads it — so a sub that
moved or was dropped before the tip still gets its revs.
One that never had a sub pays nothing: no .gitmodules in
any diff, no list, no per-commit probe.git.getTreeDiff
drops gitlinks in dog/git C (BEE-006:54:on), so nothing but a
second ODB read answers "the gitlink at P in this tree".
The C fix (gitlinks kept in GITTreeDiff, or a leaf for
one tree's gitlink at a path) is gritzko's call; it would
take the ~8 s of ODB reads this leaves in the walk..gitmodules does not name is no longer
enumerated (the whole-tree walk found it). Git treats
such a sub as unconfigured, and the old gate already refused
a repo whose tip carries no .gitmodules at all..gitmodules in any diff. A rebuild does.bee index over a git.git clone (81726 commits, two
runs each, niced): before 92.8 s / 90.5 s, after 69.1 s /
73.4 s, both sides 250344 revs and 940189 rows.