mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
0e47bca0f7
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>
21 lines
364 B
Bash
Executable file
21 lines
364 B
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='performance of reset'
|
|
. ./perf-lib.sh
|
|
|
|
test_perf_default_repo
|
|
test_checkout_worktree
|
|
|
|
test_perf 'reset --hard with change in tree' '
|
|
base=$(git rev-parse HEAD) &&
|
|
test_commit --no-tag A &&
|
|
new=$(git rev-parse HEAD) &&
|
|
|
|
for i in $(test_seq 10)
|
|
do
|
|
git reset --hard $new &&
|
|
git reset --hard $base || return $?
|
|
done
|
|
'
|
|
|
|
test_done
|