Improve coverage speed by using new caching option for package:coverage #107395
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The running e.g.
flutter test --coverageeach test file (i.e. after each vm run of a test file) will be passed throughpackage:coveragewhich - because of the option to be able to check for ignored lines - has to read all files in the source report (in the package(s) we're getting coverage for). With many test files (and depending on the dependency graph, but still) it will then keep reading the same files over and over.In dart-archive/coverage#391 I added the ability to cache these reads and this PR utilizes this in flutter.
This makes each file only be read at most once.
Trying it out in
packages/flutterbefore this PR I got this:With this PR I instead get this:
I.e. from ~828 seconds to ~617 seconds, or a ~25% reduction in time spent (testing without coverage takes ~236 seconds so the overhead of
--coveragein this case goes from ~592 seconds to ~381 seconds, or a ~35% reduction).