Commit cb02b38
committed
revision: use priority queue for non-limited streaming walks
Replace the O(N) sorted linked-list insertion used by get_revision_1()
for non-limited walks with an O(log N) priority queue.
Add a commit_queue field to rev_info alongside the existing commits
linked list. The two representations are mutually exclusive: setup and
external callers that need list access (mark_edges_uninteresting,
bisect, etc.) use the linked list, then get_revision_1() lazily drains
it into the priority queue on the first call for non-limited,
non-no_walk, non-topo, non-reflog walks.
The conversion function rev_info_commit_list_to_queue() is public so
callers that know they will iterate can convert early.
The parent-rewriting path (rewrite_one) always merges newly discovered
commits into the priority queue, which is correct because rewrite_one_1
only calls process_parents for non-limited walks where the queue is
active.
Combined with the limit_list() priority queue change in the parent
commit, this eliminates all O(N) sorted linked-list insertion from the
revision walk machinery.
Performance: git rev-list HEAD on a 2.3M-commit repository improves
from ~21s to ~6.4s (3.3x speedup).
Signed-off-by: Kristoffer Gleditsch <krka@spotify.com>1 parent ce64d4c commit cb02b38
4 files changed
Lines changed: 38 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
729 | 729 | | |
730 | 730 | | |
731 | 731 | | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | 732 | | |
746 | 733 | | |
747 | 734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
195 | | - | |
196 | 194 | | |
197 | 195 | | |
198 | 196 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1116 | 1116 | | |
1117 | 1117 | | |
1118 | 1118 | | |
1119 | | - | |
| 1119 | + | |
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
| |||
1158 | 1158 | | |
1159 | 1159 | | |
1160 | 1160 | | |
1161 | | - | |
1162 | | - | |
1163 | 1161 | | |
1164 | 1162 | | |
1165 | 1163 | | |
| |||
1207 | 1205 | | |
1208 | 1206 | | |
1209 | 1207 | | |
1210 | | - | |
1211 | | - | |
1212 | 1208 | | |
1213 | 1209 | | |
1214 | 1210 | | |
| |||
1470 | 1466 | | |
1471 | 1467 | | |
1472 | 1468 | | |
1473 | | - | |
| 1469 | + | |
1474 | 1470 | | |
1475 | 1471 | | |
1476 | 1472 | | |
| |||
3257 | 3253 | | |
3258 | 3254 | | |
3259 | 3255 | | |
| 3256 | + | |
3260 | 3257 | | |
3261 | 3258 | | |
3262 | 3259 | | |
| |||
3726 | 3723 | | |
3727 | 3724 | | |
3728 | 3725 | | |
3729 | | - | |
| 3726 | + | |
3730 | 3727 | | |
3731 | 3728 | | |
3732 | 3729 | | |
| |||
3902 | 3899 | | |
3903 | 3900 | | |
3904 | 3901 | | |
3905 | | - | |
| 3902 | + | |
3906 | 3903 | | |
3907 | 3904 | | |
3908 | 3905 | | |
| |||
3938 | 3935 | | |
3939 | 3936 | | |
3940 | 3937 | | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
3941 | 3945 | | |
3942 | 3946 | | |
3943 | 3947 | | |
| |||
4006 | 4010 | | |
4007 | 4011 | | |
4008 | 4012 | | |
4009 | | - | |
| 4013 | + | |
4010 | 4014 | | |
4011 | 4015 | | |
4012 | 4016 | | |
| |||
4020 | 4024 | | |
4021 | 4025 | | |
4022 | 4026 | | |
4023 | | - | |
| 4027 | + | |
| 4028 | + | |
4024 | 4029 | | |
4025 | | - | |
4026 | | - | |
4027 | | - | |
4028 | | - | |
4029 | | - | |
4030 | | - | |
4031 | | - | |
4032 | | - | |
4033 | | - | |
4034 | | - | |
4035 | | - | |
4036 | | - | |
| 4030 | + | |
| 4031 | + | |
4037 | 4032 | | |
4038 | 4033 | | |
4039 | 4034 | | |
4040 | 4035 | | |
4041 | 4036 | | |
4042 | 4037 | | |
4043 | | - | |
| 4038 | + | |
4044 | 4039 | | |
4045 | 4040 | | |
4046 | 4041 | | |
| |||
4336 | 4331 | | |
4337 | 4332 | | |
4338 | 4333 | | |
4339 | | - | |
| 4334 | + | |
4340 | 4335 | | |
| 4336 | + | |
| 4337 | + | |
| 4338 | + | |
| 4339 | + | |
| 4340 | + | |
4341 | 4341 | | |
4342 | 4342 | | |
4343 | 4343 | | |
| |||
4359 | 4359 | | |
4360 | 4360 | | |
4361 | 4361 | | |
4362 | | - | |
| 4362 | + | |
| 4363 | + | |
| 4364 | + | |
4363 | 4365 | | |
4364 | 4366 | | |
4365 | 4367 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
125 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
126 | 131 | | |
| 132 | + | |
| 133 | + | |
127 | 134 | | |
128 | 135 | | |
129 | 136 | | |
| |||
400 | 407 | | |
401 | 408 | | |
402 | 409 | | |
| 410 | + | |
403 | 411 | | |
404 | 412 | | |
405 | 413 | | |
| |||
478 | 486 | | |
479 | 487 | | |
480 | 488 | | |
| 489 | + | |
| 490 | + | |
481 | 491 | | |
482 | 492 | | |
483 | 493 | | |
| |||
0 commit comments