]> git.ipfire.org Git - thirdparty/git.git/commit
merge-ort: skip rename detection entirely if possible
authorElijah Newren <newren@gmail.com>
Thu, 11 Mar 2021 00:38:30 +0000 (00:38 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Mar 2021 06:18:05 +0000 (22:18 -0800)
commitf89b4f2beef515b583419b311665545b6c1dd948
tree40dff4873da256421d7f0b0cd1d35fed03cdb5bd
parent174791f0fb23e29de1d879c1aae3a164bb998885
merge-ort: skip rename detection entirely if possible

diffcore_rename_extended() will do a bunch of setup, then check for
exact renames, then abort before inexact rename detection if there are
no more sources or destinations that need to be matched.  It will
sometimes be the case, however, that either
  * we start with neither any sources or destinations
  * we start with no *relevant* sources
In the first of these two cases, the setup and exact rename detection
will be very cheap since there are 0 files to operate on.  In the second
case, it is quite possible to have thousands of files with none of the
source ones being relevant.  Avoid calling diffcore_rename_extended() or
even some of the setup before diffcore_rename_extended() when we can
determine that rename detection is unnecessary.

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:        6.003 s ±  0.048 s     5.708 s ±  0.111 s
    mega-renames:    114.009 s ±  0.236 s   102.171 s ±  0.440 s
    just-one-mega:     3.489 s ±  0.017 s     3.471 s ±  0.015 s

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