]> git.ipfire.org Git - thirdparty/git.git/commit - diffcore-rename.c
diffcore-rename: no point trying to find a match better than exact
authorElijah Newren <newren@gmail.com>
Wed, 3 Feb 2021 20:03:46 +0000 (20:03 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Feb 2021 20:04:00 +0000 (12:04 -0800)
commitf15eb7c1cf2674df69c1ff8aebdc5536a580c65e
tree77e58af6bb73bba6ffc548f4ba6e327e72ec4570
parentf0117958910fbc734457a83a9f8ecc3c62463417
diffcore-rename: no point trying to find a match better than exact

diffcore_rename() had some code to avoid having destination paths that
already had an exact rename detected from being re-checked for other
renames.  Source paths, however, were re-checked because we wanted to
allow the possibility of detecting copies.  But if copy detection isn't
turned on, then this merely amounts to attempting to find a
better-than-exact match, which naturally ends up being an expensive
no-op.  In particular, copy detection is never turned on by the merge
machinery.

For the testcases mentioned in commit 557ac0350d ("merge-ort: begin
performance work; instrument with trace2_region_* calls", 2020-10-28),
this change improves the performance as follows:

                            Before                  After
    no-renames:       14.263 s ±  0.053 s    14.119 s ±  0.101 s
    mega-renames:   5504.231 s ±  5.150 s  1802.044 s ±  0.828 s
    just-one-mega:   158.534 s ±  0.498 s    51.391 s ±  0.028 s

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-rename.c