perf(core): optimize updateTestModes traversal#1202
Conversation
Rsdoctor Bundle Diff AnalysisFound 12 projects in monorepo, 2 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 core/browserPath:
📦 Download Diff Report: core/browser Bundle Diff 📁 core/mainPath:
📦 Download Diff Report: core/main Bundle Diff Generated by Rsdoctor GitHub Action |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes the core runner’s updateTestModes normalization pass by avoiding repeated subtree scans for only propagation and by reusing precomputed name-pattern matching state.
Changes:
- Precomputes “suite has
onlydescendants” using aWeakMap(collectOnlyTests) and reuses it during traversal. - Refactors traversal into a context-based implementation (
traverseUpdateTestRunModeWithContext) to reuse shared state, including a single name-pattern predicate.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Background
updateTestModeswas repeatedly rescanning suite subtrees foronlyhandling and rebuilding name-match work per test, which showed up in synthetic runner benchmarks.Implementation
onlydescendants with aWeakMap, then reuse that state during the run-mode traversal.testNamePatternmatcher;User Impact
Large collected test trees spend less time normalizing run modes before execution; no user-facing API changes.
Benchmark
Result:
681ms(build 78ms,tests 603ms), wall clockreal 1.53s562ms(build 70ms,tests 492ms), wall clockreal 1.21sChecklist