Commit e4fd06e
diffcore-rename: avoid doing basename comparisons for irrelevant sources
The basename comparison optimization implemented in
find_basename_matches() is very beneficial since it allows a source to
sometimes only be compared with one other file instead of N other files.
When a match is found, both a source and destination can be removed from
the matrix of inexact rename comparisons. In contrast, the irrelevant
source optimization only allows us to remove a source from the matrix of
inexact rename comparisons...but it has the advantage of allowing a
source file to not even be loaded into memory at all and be compared to
0 other files. Generally, not even comparing is a bigger performance
win, so when both optimizations could apply, prefer to use the
irrelevant-source optimization.
For the testcases mentioned in commit 557ac03 ("merge-ort: begin
performance work; instrument with trace2_region_* calls", 2020-10-28),
this change improves the performance as follows:
Before After
no-renames: 5.708 s ± 0.111 s 5.680 s ± 0.096 s
mega-renames: 102.171 s ± 0.440 s 13.812 s ± 0.162 s
just-one-mega: 3.471 s ± 0.015 s 506.0 ms ± 3.9 ms
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent f89b4f2 commit e4fd06e
1 file changed
+33
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
527 | 527 | | |
528 | 528 | | |
529 | 529 | | |
| 530 | + | |
530 | 531 | | |
531 | 532 | | |
532 | 533 | | |
533 | 534 | | |
534 | 535 | | |
535 | 536 | | |
536 | 537 | | |
537 | | - | |
| 538 | + | |
538 | 539 | | |
539 | 540 | | |
540 | 541 | | |
| |||
549 | 550 | | |
550 | 551 | | |
551 | 552 | | |
552 | | - | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
553 | 567 | | |
554 | 568 | | |
555 | 569 | | |
| |||
627 | 641 | | |
628 | 642 | | |
629 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
630 | 651 | | |
631 | 652 | | |
632 | 653 | | |
| |||
749 | 770 | | |
750 | 771 | | |
751 | 772 | | |
| 773 | + | |
752 | 774 | | |
753 | 775 | | |
754 | 776 | | |
| |||
839 | 861 | | |
840 | 862 | | |
841 | 863 | | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
842 | 869 | | |
843 | 870 | | |
844 | 871 | | |
| |||
1164 | 1191 | | |
1165 | 1192 | | |
1166 | 1193 | | |
1167 | | - | |
| 1194 | + | |
1168 | 1195 | | |
1169 | 1196 | | |
1170 | 1197 | | |
1171 | 1198 | | |
1172 | 1199 | | |
1173 | 1200 | | |
1174 | 1201 | | |
1175 | | - | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
1176 | 1205 | | |
1177 | 1206 | | |
1178 | 1207 | | |
| |||
0 commit comments