Repository navigation
test(sidebar): the rebuild check waits on turns and the list's state, not fixed sleeps (47 s to 7 s, 122 s to 30 s) - #31206
Merged
Conversation
… not on fixed sleeps SidebarIncrementalMatchesRebuildTests.expectMatchesRebuild let the list's completions run with three 30 ms sleeps, then looked 200 times for a match: a for-where loop that slept only while the list differed but kept looking after it matched. Nothing on the main thread changes between two looks with no await between them, so the 199 looks after a match were waste (100 to 130 ms a check), and the sleeps took 90 to 440 ms a check on a fleet mini. Together they were 37 of the suite's 45 s and 100 of SidebarIncrementalMatchesRebuildGapsTests' 122 s (diag job b5651a8eb364 on cmux7s, 329 checks). The completions now run in three main-thread turns (a yield for queued main-actor work, a run loop pass that does not wait, then the window's layout, display and commit), and the wait is a while loop with the same 50 ms sleeps, the same three conditions (equal to the rebuild, no layer animation, no fading row) and the same 10 s cap. Every operation, every check and every compared field is unchanged. Of the 329 checks in the diag run, 5 needed the wait to sleep (motion on), and they still get it.
|
Found 1 test failure on Blacksmith runners: Failure
|
Contributor
Author
|
Review (independent review subagent, Opus 5.5 claude-opus-5-5, read-only): SHIP at e35bab8 The reviewer confirmed:
Low, not blocking, existed before this PR:
Owner a590 (sidebar). |
lawrencecchen
marked this pull request as ready for review
November 1, 2026 18:31
lawrencecchen
temporarily deployed
to
ci-routing-agent
November 1, 2026 18:31 — with
GitHub Actions
Inactive
Contributor
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Review App of this head (app.zip, kept 1 day)
Shipped in:
|
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
![Fix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-3x.png)
Summary
SidebarIncrementalMatchesRebuildTests.expectMatchesRebuild(also used bySidebarIncrementalMatchesRebuildGapsTests) spent most of both suites' time in two fixed waits:for _ in 0..<200 where <differs or animates or fades> { sleep 50 ms }. Afor … whereloop does not stop at the first match: it sleeps only while the list differs, but it looks 200 times. Nothing on the main thread changes between two looks with noawaitbetween them, so the 199 looks after a match were waste: 100 to 130 ms per check.Diag job b5651a8eb364 (cmux7s, 329 checks): these two waits were 37 of 45 s in the base suite and 100 of 122 s in the Gaps suite.
Change (test-only, one file):
turn): a yield for queued main-actor work, a run-loop pass that does not wait, then the window's layout, display and Core Animation commit (this runs the completion blocks of changes that did not animate).whileloop with the same 50 ms sleep, the same three conditions (equal to the rebuild, no layer animation, no fading row) and the same 10 s cap. It ends at the first look that matches.Every operation, check and compared field stays the same. In diag job 183c33f81446 (cmux10s), 46 of 223 checks still had to sleep (springs and fades with motion on), and the loop still waits for them.
Owner: a590 (sidebar-owner agent, plans/cmux-next/sidebar-owner.md). No
CmuxNextSidebarsource changes, so noSidebar-Looktrailer.Performance
Suite time (
✔ Suite X passed after N seconds):Other runs at the head: cmux10s 5.8 s / 29.5 s (98a24281f3fb), diag 183c33f81446 on cmux10s 29.2 s for the Gaps suite.
Under load the Gaps suite is still slow at both ends, and this PR does not fix that:
theListMatchesAFreshRebuild(_:) made no progress for 180s, job 80bb54a3d540).I did not find where that time goes: the diag runs were on quiet hosts. The base suite (reduce motion, no
NSEventpath) stays at 6.5 to 6.8 s under the same load.Testing
cmux-ci run --class light --display --target-worker <host> --script scripts/ci/package-test-lane.sh --ref <sha> --arg=suite --arg=Packages/macOS/CmuxNext --arg=SidebarIncrementalMatchesRebuildTests,SidebarIncrementalMatchesRebuildGapsTests --env CMUX_TEST_REQUIRE_GUI=1 --env CMUX_CI_XCODE_APP=/Applications/Xcode_26.6.app: all 25 cases pass at the head.Observed / Not run
speed-sidebar-diagandspeed-sidebar-diag3(not for merge).Changelog
none
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by cubic
Speeds up the sidebar rebuild test helper by waiting on main-thread turns and the list's state instead of fixed sleeps.
SidebarIncrementalMatchesRebuildTests.expectMatchesRebuildnow runs the completions in three main-thread turns (a yield, a non-blocking run-loop pass, then layout, display and commit) instead of three 30 ms sleeps, and the match wait is awhileloop with the same conditions and 10 s cap that stops at the first match instead of afor … whereloop that kept looking 199 times. All checks, operations and compared fields are unchanged; all 25 cases pass. Suite time drops from 47 s to 7 s (SidebarIncrementalMatchesRebuildTests) and 122 s to 30 s (SidebarIncrementalMatchesRebuildGapsTests). Under load the Gaps suite is still slow, but fixing that is out of scope here.Written for commit e35bab8. Summary will update on new commits.