Repository navigation
Headless test waits leave the CPU to the work they wait for - #4201
THEtheChad wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
1bd6fde to
9dcf487
Compare
settle, step_until and request drew a frame every millisecond while the app was busy. On a loaded machine those frames took about half of the ui-egui test binary's CPU, away from the renders and merges the tests were waiting on, and three waits ran past their limits (storytold#3981). While busy, the harness now waits for a render to finish, or 10 ms, before the next frame. 10 ms is shorter than a simulated frame, so the app still runs ahead of real time. Refs storytold#3981
9dcf487 to
df3a1a3
Compare
vangel76
left a comment
There was a problem hiding this comment.
Reviewed df3a1a33. No findings. I traced settling, waiting, and requests through the native-worker and no-worker paths, and checked the existing pacing regression.
Source review only. I did not build the project, run tests, or check CI.
wanikhawar
left a comment
There was a problem hiding this comment.
The headless harness paces frames by pending work instead of redrawing every millisecond. Test-only.
Refs #3981
Problem
Three
lightcraft-ui-eguitests fail under suite load and pass alone (#3981). Every expired wait finished later; nothing deadlocked or was lost. The headless harness added to the load itself: while the app was busy,settle,step_untilandrequestdrew a frame every 1 ms, each laying out the whole UI. On a 4-core run those frames took about half the test binary's CPU (2029 s of 4129 s), away from the renders and merges the tests were waiting for.Change
crates/ui-egui/src/headless.rs: whilebusy(), the three loops call a newwait_for_workbetween frames. It waits up toBUSY_PAUSE(10 ms) for a render to finish (wait_for_worker), else sleeps the rest of the pause (a merge, file checks, input).step_untilkeeps its 1 ms pause when nothing is busy.Tests
headless::tests::waits_pace_their_frames_while_a_render_is_outholds a render out and counts the frames a 300 mssettleandstep_untildraw. Onmainit failed 3 of 3 runs (74–92 frames, at most 32 allowed); it passes with the change. Load can only lower the count, so it can't flake toward failing.main27b755a (includes Find Similar test: photos measured from memory aren't missing reads (#3823) #3824, which fixes the Find Similar test this change exposed more often):cargo xtask ci --quick(with craft-fonts) passed all 8 steps;cargo test -p lightcraft-ui-egui --lib1937 passed; thefind_similarandheadlesstests passed 5 runs in a row.cargo xtask ci, macOS, Windows.Notes
settleandstep_until; whichever lands second has a small doc-comment rebase.Summary by CodeRabbit