• auto-submit[bot]'s avatar
    Reverts "Use `coverage.collect`'s `coverableLineCache` param to speed up coverage" (#137121) · 8df62188
    auto-submit[bot] authored
    Reverts flutter/flutter#136851
    Initiated by: CaseyHillers
    This change reverts the following previous change:
    Original Description:
    One of the reasons gathering coverage information is expensive is that we have to force compile every function in the libraries we're interested in. Without this, functions that haven't been invoked (so haven't been compiled) won't have any line number information, so the coverage tool doesn't know which lines to add to the list of misses. In flutter's case, the test infra spawns many VMs, and each of these needs to recompile all those libraries.
    
    To fix this, we need a way of skipping force compilation for libraries we've already seen in previous tests, without losing the information about which lines in each library are coverable. So I [added](https://github.com/dart-lang/coverage/pull/466) the `coverableLineCache` to `coverage.collect` in package:coverage v1.7.0. This cache starts out empty, but fills up with lists of all the lines that are coverable for every library as coverage is gathered. package:coverage can then tell the VM not to force compile any libraries in this cache (using `getSourceReport`'s `librariesAlreadyCompiled` param). So the first test suite will still have to compile everything, but subsequent test suites will be much faster.
    
    This speeds up coverage collection significantly, for large test suites:
    
    | Running flutter/packages/flutter tests... | Time | Overhead |
    | --- | --- | --- |
    | without coverage | 8:53 | - |
    | with coverage | 20:25 | 130% |
    | with `coverableLineCache` | 12:21 | 40% |
    
    Bug: https://github.com/flutter/flutter/issues/100751
    8df62188
coverage_collector_test.dart 23.2 KB