Skip to content

perf: avoid rescanning test children in Test Explorer - #347176

Merged
Connor Peet (connor4312) merged 3 commits into
microsoft:mainfrom
SimonSiefke:perf/test-computed-state
Nov 10, 2026
Merged

Connor Peet (connor4312) merged 3 commits into
microsoft:mainfrom
SimonSiefke:perf/test-computed-state

Conversation

@SimonSiefke

@SimonSiefke Simon Siefke (SimonSiefke) commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

This PR is related to #346656.

Details

When tests in a large suite finish, each result update scans the other tests to recompute the suite's state and total duration. Repeating these scans for thousands of tests slows down Test Explorer.

Change

Cache child state counts and update duration totals as individual tests change. This avoids repeatedly scanning the whole suite and skips redundant parent updates in Test Explorer, while preserving result clearing and zero-duration tests.

Renderer before

Renderer CPU profile before, shared 0–25 second scale

Renderer after

Renderer CPU profile after, shared 0–25 second scale

Performance

5000 Mocha tests

Metric Before After Change
Renderer CPU (sampled mean) 19.34 s 6.23 s −67.8%
Run to visible results and output (median) 15.46 s 4.84 s −68.7%
Copilot AI balanced review requested due to automatic review settings November 9, 2026 21:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified in the changes to cache child aggregates and improve Test Explorer performance for large suites.

No open issues 🎉

What changed in this PR

Improves Test Explorer performance for large suites by caching child aggregates instead of repeatedly scanning siblings as test results arrive.

Changes:

  • Cache child state counts and update duration totals incrementally.
  • Skip redundant parent recomputation while preserving result clearing and zero-duration handling.
  • Add regression tests for aggregation, duration updates, and result lifecycle behavior.
File Description
src/​vs/​workbench/​contrib/​testing/​test/​common/​testResultService.test.ts Excludes the runtime cache from serialization expectations.
src/​vs/​workbench/​contrib/​testing/​test/​common/​getComputedState.test.ts Tests cached aggregation, scan counts, and duration edge cases.
src/​vs/​workbench/​contrib/​testing/​test/​browser/​explorerProjections/​treeProjection.test.ts Tests redundant-update avoidance, result clearing, and duration transitions.
src/​vs/​workbench/​contrib/​testing/​common/​testResult.ts Adds node-owned state caches to live test results.
src/​vs/​workbench/​contrib/​testing/​common/​getComputedState.ts Implements cached state counts and incremental duration aggregation.
src/​vs/​workbench/​contrib/​testing/​browser/​explorerProjections/​treeProjection.ts Integrates caches and refines parent refresh and zero-duration handling.

Review effort: Balanced

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) November 9, 2026 23:44
@connor4312
Connor Peet (connor4312) merged commit 9ffcb0d into microsoft:main Nov 10, 2026
52 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.147.0 milestone Nov 10, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the perf/test-computed-state branch November 11, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants