summaryrefslogtreecommitdiffstats
path: root/t/t4018/cpp-function-returning-pointer
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2026-02-12 15:53:50 +0000
committerJunio C Hamano <gitster@pobox.com>2026-02-12 09:28:49 -0800
commitdd2a4c0c7acb588abbf3c3a39ca755ce8aeee3b0 (patch)
tree9734c73658b1f543612b90c09aac1733c2f84a9f /t/t4018/cpp-function-returning-pointer
parent67ad42147a7acc2af6074753ebd03d904476118f (diff)
downloadgit-dd2a4c0c7acb588abbf3c3a39ca755ce8aeee3b0.tar.gz
git-dd2a4c0c7acb588abbf3c3a39ca755ce8aeee3b0.zip
diff --anchored: avoid checking unmatched lines
For a line to be an anchor it has to appear in each of the files being diffed exactly once. With that in mind lets delay checking whether a line is an anchor until we know there is exactly one instance of the line in each file. As each line is checked at most once, there is no need to cache the result of is_anchor() and we can drop that field from the hashmap entries. When diffing 5000 recent commits in git.git this gives a modest speedup of ~2%. In the (rather extreme) example below that consists largely of deletions the speedup is ~16%. seq 0 10000000 >old printf '%s\n' 300000 100000 200000 >new git diff --no-index --anchored=300000 old new Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018/cpp-function-returning-pointer')
0 files changed, 0 insertions, 0 deletions