Commit 6be50a4
[analyzer] Fix signature calculation when merging yaml files with "error" keys
**TL;DR**
In certain situations a new signature was created for every
analyzer start causing more work than needed to be done and filling up
the cache for no reason. The fix can cause the startup cost to improve
significantly.
**Details**
When merging analysis options yaml files (when one file includes
another), and both include data under "analyzer: errors:" we get
inconsistent signatures because of ordering issues. This causes "old
work" to be redone and more files to be written.
This CL fixes the issue by not introducing a semi-random order when
merging.
For the contexts I have open, the following files gives (gave) a bad
(inconsistent) signature:
pkg/analyzer/test/analysis_options.yaml
pkg/front_end/analysis_options.yaml
pkg/analysis_server/test/analysis_options.yaml
Looking at the time it takes from the first read/write until the last:
Before:
37.148419
37.273016
36.807384
Now:
14.164655
15.251373
15.108677
While the difference is easily visible, for good measure:
```
Difference at 95.0% confidence
-22.2347 +/- 1.0223
-59.9702% +/- 2.7573%
(Student's t, pooled s = 0.45103)
```
And from the column "time" in top (note that I'm running from source so
that this includes the initial dart compile of the analyzer):
Before:
1:10.84
1:09.81
1:26.98
Now:
0:38.03
0:38.72
0:37.79
Again the difference is easily visible, but for good measure:
```
Difference at 95.0% confidence
-37.6967 +/- 15.4529
-49.6815% +/- 20.3658%
(Student's t, pooled s = 6.81767)
```
If clearing the cache and opening (waiting for writes to complete),
closing and repeating, before this CL I got this with the contexts I
have open:
After 1st open:
```
$ du -chs ~/.dartServer/
186M total
```
After the 2nd open:
```
$ du -chs ~/.dartServer/
212M total
```
=> +26MB
After the 3rd open:
```
$ du -chs ~/.dartServer/
247M total
$ find ~/.dartServer/ | wc -l
25713
```
=> +35MB
After the 4th open:
```
$ du -chs ~/.dartServer/
272M total
$ find ~/.dartServer/ | wc -l
27769
```
=> +25MB; +2056 files
After the 5th open:
```
$ du -chs ~/.dartServer/
297M total
$ find ~/.dartServer/ | wc -l
29825
```
=> +25MB; +2056 files
After the 6th open:
```
$ du -chs ~/.dartServer/
321M total
$ find ~/.dartServer/ | wc -l
31881
```
=> +24MB; +2056 files
And we seem to have reached a point where we can guess the 7th if we want to.
And with the fix in this CL:
After 1st open:
```
$ du -chs ~/.dartServer/
186M total
$ find ~/.dartServer/ | wc -l
20816
```
After 2nd:
```
$ du -chs ~/.dartServer/
186M total
$ find ~/.dartServer/ | wc -l
20816
```
After the 3rd:
```
$ du -chs ~/.dartServer/
186M total
$ find ~/.dartServer/ | wc -l
20816
```
And it seems that it's stable.
We might also want to sort the strings as ordering (probably?) doesn't
matter, but I'll leave that for another CL.
Change-Id: Id06ca84e8b063bb31a261753f56620443f341a2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410700
Commit-Queue: Jens Johansen <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>1 parent 3702cbe commit 6be50a4
File tree
3 files changed
+95
-8
lines changed- pkg/analyzer
- lib/src/util
- test/src
- options
- util
3 files changed
+95
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | 5 | | |
8 | 6 | | |
9 | 7 | | |
| |||
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
36 | | - | |
37 | | - | |
| 34 | + | |
| 35 | + | |
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
| |||
76 | 74 | | |
77 | 75 | | |
78 | 76 | | |
79 | | - | |
80 | | - | |
| 77 | + | |
| 78 | + | |
81 | 79 | | |
82 | 80 | | |
83 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
34 | | - | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
414 | 416 | | |
415 | 417 | | |
416 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
417 | 458 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
97 | 142 | | |
98 | 143 | | |
99 | 144 | | |
| |||
103 | 148 | | |
104 | 149 | | |
105 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
106 | 154 | | |
107 | 155 | | |
108 | 156 | | |
| |||
0 commit comments