Skip to content

Conversation

@jensjoha
Copy link
Contributor

The running e.g. flutter test --coverage each test file (i.e. after each vm run of a test file) will be passed through package:coverage which - 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/flutter before this PR I got this:

$ time flutter test --coverage

[...]

13:45 +10875 ~66 -1: Some tests failed.                                                                                                                                                        

real    13m48.726s
user    78m56.959s
sys     10m21.363s

With this PR I instead get this:

$ time flutter test --coverage

[...]

10:13 +10875 ~66 -1: Some tests failed.                                                                                                                                                        

real    10m17.241s
user    75m49.775s
sys     10m7.498s

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 --coverage in this case goes from ~592 seconds to ~381 seconds, or a ~35% reduction).

@jensjoha jensjoha requested a review from jonahwilliams July 11, 2022 10:04
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jul 11, 2022
Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jensjoha jensjoha merged commit 803ef6a into flutter:master Jul 13, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 13, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jul 13, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
…ge (flutter#107395)

Speedup coverage test runs by using (new) coverage handle with caching.

On a `flutter test --coverage` run on `packages/flutter` the runtime goes from ~828 seconds to ~617 seconds, or a ~25% reduction in time spent (testing without coverage takes ~236 seconds so the overhead of `--coverage` in this case goes from ~592 seconds to ~381 seconds, or a ~35% reduction).
@jensjoha jensjoha deleted the coverage_with_caching branch August 18, 2022 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants