You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
unpack-trees: cheaper index update when walking by cache-tree
With the new cache-tree, we could mostly avoid I/O (due to odb access)
the code mostly becomes a loop of "check this, check that, add the
entry to the index". We could skip a couple checks in this giant loop
to go faster:
- We know here that we're copying entries from the source index to the
result one. All paths in the source index must have been validated
at load time already (and we're not taking strange paths from tree
objects) which means we can skip verify_path() without compromise.
- We also know that D/F conflicts can't happen for all these entries
(since cache-tree and all the trees are the same) so we can skip
that as well.
This gives rather nice speedups for "unpack trees" rows where "unpack
trees" time is now cut in half compared to when
traverse_by_cache_tree() is added, or 1/7 of the original "unpack
trees" time.
baseline cache-tree this patch
--------------------------------------------------------------------
0.018239226 0.019365414 0.020519621 s: read cache .git/index
0.052541655 0.049605548 0.048814384 s: preload index
0.001537598 0.001571695 0.001575382 s: refresh index
0.168167768 0.049677212 0.024719308 s: unpack trees
0.002897186 0.002845256 0.002805555 s: update worktree after a merge
0.131661745 0.136597522 0.134891617 s: repair cache-tree
0.075389117 0.075422517 0.074832291 s: write index, changed mask = 2a
0.111702023 0.032813253 0.008616479 s: unpack trees
0.000023245 0.000022002 0.000026630 s: update worktree after a merge
0.111793866 0.032933140 0.008714071 s: diff-index
0.587933288 0.398924370 0.380452871 s: git command: /home/pclouds/w/git/git
Total saving of this new patch looks even less impressive, now that
time spent in unpacking trees is so small. Which is why the next
attempt should be on that "repair cache-tree" line.
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
0 commit comments