Skip to content

perf: make the Test Explorer faster when running many tests - #345896

Merged
Connor Peet (connor4312) merged 4 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-test-explorer
Nov 4, 2026
Merged

Connor Peet (connor4312) merged 4 commits into
microsoft:mainfrom
SimonSiefke:fix/memory-leak-test-explorer

Conversation

@SimonSiefke

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

Copy link
Copy Markdown
Contributor

Fixes #238241.

Details

Large test runs send many state and duration changes for the same visible rows. Each change creates another managed hover and rebuilds the row's actions. The repeated listener and action work delays the renderer after Mocha has finished.

Change

Keep one hover per row template and update its contents. Batch row renders within an event-loop turn, cancel pending renders when a row is removed, and dispose both row and template resources.

Before

Much of the renderer CPU time is spent on event listener work from repeatedly creating row hovers and rebuilding actions.

Before

After

79.1% less renderer CPU time for 500 Mocha tests.

After

Test Video

Test.webm

Additional Details

Running 5000 Mocha Tests in VSCode

Metric Before (ms) After (ms) Change
Renderer CPU 949,320 15,780 -98.3%
Extension-host CPU 7,900 3,840 -51.4%
Run to rendered output 897,007 13,668 -98.5%
Full e2e wall time 915,180 32,505 -96.4%
Standalone Mocha CLI wall time 547 547 -

AI disclosure: Model: GPT 6.1 Sol. Worktime: 37 min

Copilot AI balanced review requested due to automatic review settings November 3, 2026 19:39

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 remain for the Test Explorer hover reuse and batched row-rendering changes.

No open issues 🎉

What changed in this PR

Improves Test Explorer responsiveness during large test runs by reducing repeated hover creation and row-rendering work.

Changes:

  • Reuses one managed hover per row template and updates its content.
  • Batches row updates within an event-loop turn and cancels pending renders when rows are removed.
  • Adds regression coverage for batching, hover reuse, and disposal.

No actionable findings remain.

File Description
src/​vs/​workbench/​contrib/​testing/​test/​browser/​testingExplorerView.test.ts Adds tests for batched updates, persistent hovers, and cleanup.
src/​vs/​workbench/​contrib/​testing/​browser/​testingExplorerView.ts Reuses row hovers, schedules batched renders, and disposes row and template resources.

Review effort: Balanced

@SimonSiefke Simon Siefke (SimonSiefke) changed the title Make the Test Explorer faster when running many tests perf: make the Test Explorer faster when running many tests Nov 3, 2026

@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.

👏

@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) November 3, 2026 22:21
@connor4312

Copy link
Copy Markdown
Member

Simon Siefke (@SimonSiefke) looks like a test failure

auto-merge was automatically disabled November 3, 2026 23:30

Head branch was pushed to by a user without write access

@SimonSiefke

Copy link
Copy Markdown
Contributor Author

Fixed flaky test by using fake timers!

@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) November 3, 2026 23:33
@connor4312
Connor Peet (connor4312) merged commit c4fab9a into microsoft:main Nov 4, 2026
59 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.146.0 milestone Nov 4, 2026
@SimonSiefke
Simon Siefke (SimonSiefke) deleted the fix/memory-leak-test-explorer branch November 5, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test Run completion takes very long on many tests (after RunHandler is completed)

5 participants