]> git.ipfire.org Git - thirdparty/git.git/commit
reset: use 'skip_cache_tree_update' option
authorVictoria Dye <vdye@github.com>
Thu, 10 Nov 2022 19:06:03 +0000 (19:06 +0000)
committerTaylor Blau <me@ttaylorr.com>
Fri, 11 Nov 2022 02:49:34 +0000 (21:49 -0500)
commit0e47bca0f7592f8053ffcc530d8afa1d2e364563
tree3b9f052368b9ec903211b02b0fb08fca58957497
parent68fcd48bafa1ef51b1ba40a41cb0fcdbad7acce1
reset: use 'skip_cache_tree_update' option

Enable the 'skip_cache_tree_update' option in the variants that call
'prime_cache_tree()' after 'unpack_trees()' (specifically, 'git reset
--mixed' and 'git reset --hard'). This avoids redundantly rebuilding the
cache tree in both 'cache_tree_update()' at the end of 'unpack_trees()' and
in 'prime_cache_tree()', resulting in a small (but consistent) performance
improvement. From the newly-added 'p7102-reset.sh' test:

Test                         before            after
--------------------------------------------------------------------
7102.1: reset --hard (...)   2.11(0.40+1.54)   1.97(0.38+1.47) -6.6%

Signed-off-by: Victoria Dye <vdye@github.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
builtin/reset.c
t/perf/p7102-reset.sh [new file with mode: 0755]