Commit a676b7f
Improve the performance of the bulk fix processor
This improvement was found by Jens.
The bulk fix processor needs to be able to revert a partial set of edits
that can't be completed because of a conflicting pre-existing edit. In
order to do that efficiently it needs to know whether there are any
edits to be reverted, which it used to do by computing a hash from the
edits both before and after running a correction producer. Computing
the hashes is expensive.
This CL changes the detection to use a modification counter that's
incremented any time new edits are added, removing the computation of
the hash values.
I don't yet have a benchmark for the case that uncovered the issue,
but I do have code that generates a file containing 10,000 violations
of the prefer_single_quotes lint, requests bulk fix results 5 times
to warm up the VM, then requests fixes 5 more times and prints an
average (the times between runs are fairly close, so the standard
deviation is small). The code uses the legacy protocol to request the
fixes, but it doesn't execute any of the code in dartdev.)
Before this change the average was 20670.6 ms.
After this change the average ise 13979.0 ms.
This represents a 32% improvement.
Change-Id: I74c079bef8e095acf4ad36de6d0c0241934f79a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425221
Commit-Queue: Brian Wilkerson <[email protected]>
Reviewed-by: Samuel Rawlins <[email protected]>
Reviewed-by: Jens Johansen <[email protected]>1 parent 108e40f commit a676b7f
File tree
3 files changed
+22
-31
lines changed- pkg
- analysis_server/lib/src/services/correction
- analyzer_plugin/lib/src/utilities/change_builder
3 files changed
+22
-31
lines changedLines changed: 4 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
862 | 862 | | |
863 | 863 | | |
864 | 864 | | |
865 | | - | |
866 | | - | |
867 | | - | |
| 865 | + | |
| 866 | + | |
868 | 867 | | |
869 | | - | |
870 | | - | |
| 868 | + | |
| 869 | + | |
871 | 870 | | |
872 | 871 | | |
873 | 872 | | |
| |||
Lines changed: 14 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
62 | 74 | | |
63 | 75 | | |
64 | 76 | | |
| |||
67 | 79 | | |
68 | 80 | | |
69 | 81 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | 82 | | |
91 | 83 | | |
92 | 84 | | |
| |||
270 | 262 | | |
271 | 263 | | |
272 | 264 | | |
| 265 | + | |
273 | 266 | | |
274 | 267 | | |
275 | 268 | | |
| |||
625 | 618 | | |
626 | 619 | | |
627 | 620 | | |
| 621 | + | |
628 | 622 | | |
629 | 623 | | |
630 | 624 | | |
| |||
Lines changed: 4 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1228 | 1228 | | |
1229 | 1229 | | |
1230 | 1230 | | |
1231 | | - | |
1232 | | - | |
| 1231 | + | |
| 1232 | + | |
1233 | 1233 | | |
1234 | 1234 | | |
1235 | 1235 | | |
| |||
1728 | 1728 | | |
1729 | 1729 | | |
1730 | 1730 | | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
| 1731 | + | |
1734 | 1732 | | |
1735 | 1733 | | |
1736 | 1734 | | |
| |||
2814 | 2812 | | |
2815 | 2813 | | |
2816 | 2814 | | |
2817 | | - | |
| 2815 | + | |
2818 | 2816 | | |
2819 | 2817 | | |
2820 | 2818 | | |
| |||
0 commit comments