Repository navigation
perf(tui,gpu): draw Rio content before the first poll and spawn the child earlier - #82
Merged
Merged
Conversation
…hild earlier A Rio open showed an empty panel for ~30 ms. The parent spawned the PTY child only after the whole GL setup, and the child then waited up to a frame in poll_batch before its first draw. The TUI loop now draws before it first waits for input. GlState::new is split: open_window creates the window and picks the GL config, then resumed joins the fonts, computes the grid and spawns the Rio child, and GlState::new builds the context, surface and renderer while the child starts. The blank first present stays at alpha 0, and the fade-in now starts on the first frame with glyphs. The child now redraws on terminal resize. poll_batch dropped Event::Resize, so the Rio grid re-laid out only after the next key. Interleaved A/B against main (n=30 per cell): Rio first-content p95 drops ~33 ms in both profiles (perf 74.0 -> 40.6 cold, balanced 79.9 -> 45.7) and is within 0.7-5.4 ms of native. Native is unchanged. docs/hotpath-findings.md records the results.
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.
NUKE-113. A Rio open showed an empty panel for about 30 ms. The parent spawned the PTY child only after the whole GL setup, and the child then waited up to 16 ms in
poll_batchbefore its first draw.Changes
tui_loop(src/main.rs) draws the first frame before the first input wait. It's a testable loop withdrawandpollclosures.GlState::newis split.GlState::open_windowcreates the window and picks the GL config.resumedthen joins the fonts, computes the grid and spawns the Rio child.GlState::newthen builds the context, surface and renderer while the child starts up.fade_step) starts on the first frame with glyphs. In practice the child now finishes drawing before GL setup does, so the first present already has content.poll_batchdroppedEvent::Resize, so after a window resize the Rio grid re-laid out only after the next key. Resize now triggers a redraw. This was pre-existing onmain; it was found during manual testing and fixed here on request.docs/hotpath-findings.mdmarks finding 3 fixed and gains an "After NUKE-113" section.docs/hotpath-profiling.mdlists the split phases.Results
Interleaved A/B against
main(dca12a7), 30 cold + 30 warm opens per cell. First-content p95, in ms:Validation
cargo fmt --check.-D warnings, default features and--all-features.cargo test --all-targetswith default,hotpathandhotpath-allocfeatures: 334 / 335 / 335 passed. New tests cover the draw-first loop, idle draws while effects run, the fade rule, and resize mapping.GlState::open_window,GlState::newandSession::spawn.--measureexits normally.