Commit cca7b1c
test_runner: avoid recompiling coverage globs for every file
`shouldSkipFileCoverage()` called `matchGlobPattern()` for each covered
file, and `matchGlobPattern()` builds a fresh Minimatch (a full glob
parse and regexp compile) on every call. The coverage exclude/include
globs never change during a run, so the same patterns were recompiled
once per file, which dominated the coverage report time.
Compile `coverageExcludeGlobs`/`coverageIncludeGlobs` to matchers once
per `TestCoverage` instance and reuse them for every file. Expose
`createMatcher()` from `internal/fs/glob` for this.
On a synthetic 200-test-file project this drops shouldSkipFileCoverage
from ~117ms to ~11ms (cpu-prof, isolation=none); the saving scales with
files * globs.
Refs: #55103
Signed-off-by: sangwook <rewq5991@gmail.com>
PR-URL: #63675
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>1 parent 1ae3849 commit cca7b1c
2 files changed
Lines changed: 20 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
947 | 947 | | |
948 | 948 | | |
949 | 949 | | |
| 950 | + | |
950 | 951 | | |
951 | 952 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
550 | 552 | | |
551 | 553 | | |
552 | 554 | | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
557 | 564 | | |
558 | 565 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
566 | 569 | | |
567 | 570 | | |
568 | 571 | | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
575 | 576 | | |
576 | 577 | | |
577 | 578 | | |
| |||
0 commit comments