Repository navigation
Commit be1a850
committed
Apply thousands of fixes in time linear in their number
Patcher copied the accepted runs of a file for each group of diffs:
the runs looked up for the group still referenced them when array_splice()
inserted the group's runs, and array_splice() builds a new array even to
append one at the end, which is where the runs of diffs coming in the order
of their lines go.
Removing all 50,000 entries of a baseline with --fix spent 15.3 s in
Patcher::apply() and now 0.3 s, the whole --fix of the project took 41.9 s
and now 17.5 s.
Amp-Thread-ID: https://ampcode.com/threads/T-01a1a198-fa57-7583-9394-63372a7e2fa81 parent 48f825b commit be1a850
2 files changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
39 | 60 | | |
0 commit comments