| commit | 6be50a489f8471d962fa3b5a6048085adb1e980b | [log] [tgz] |
|---|---|---|
| author | Jens Johansen <jensj@google.com> | Wed Feb 19 23:12:17 2025 -0800 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Feb 19 23:12:17 2025 -0800 |
| tree | b026996f5fa1855a0678ad9d8229255515d1c119 | |
| parent | 3702cbe573ea2b64f9b6a5dff116f53e431e0791 [diff] |
[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 <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Dart is:
Approachable: Develop with a strongly typed programming language that is consistent, concise, and offers modern language features like null safety and patterns.
Portable: Compile to ARM, x64, or RISC-V machine code for mobile, desktop, and backend. Compile to JavaScript or WebAssembly for the web.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app. Diagnose app issues using DevTools.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents in our repo at docs.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.
Future plans for Dart are included in the combined Dart and Flutter roadmap on the Flutter wiki.