summaryrefslogtreecommitdiff
path: root/line-log.c
diff options
context:
space:
mode:
authorLibravatar Elijah Newren <newren@gmail.com>2021-02-14 07:35:01 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-02-15 18:02:16 -0800
commit829514c5151deee1b37cdeaf451bf28219602126 (patch)
tree4c1db09856638b1192df2903d19b20c0e57dfeeb /line-log.c
parentdiffcore-rename: no point trying to find a match better than exact (diff)
downloadtgif-829514c5151deee1b37cdeaf451bf28219602126.tar.xz
diffcore-rename: filter rename_src list when possible
We have to look at each entry in rename_src a total of rename_dst_nr times. When we're not detecting copies, any exact renames or ignorable rename paths will just be skipped over. While checking that these can be skipped over is a relatively cheap check, it's still a waste of time to do that check more than once, let alone rename_dst_nr times. When rename_src_nr is a few thousand times bigger than the number of relevant sources (such as when cherry-picking a commit that only touched a handful of files, but from a side of history that has different names for some high level directories), this time can add up. First make an initial pass over the rename_src array and move all the relevant entries to the front, so that we can iterate over just those relevant entries. 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.119 s ± 0.101 s 13.815 s ± 0.062 s mega-renames: 1802.044 s ± 0.828 s 1799.937 s ± 0.493 s just-one-mega: 51.391 s ± 0.028 s 51.289 s ± 0.019 s Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'line-log.c')
0 files changed, 0 insertions, 0 deletions