Repository navigation
fix(rune-kit): display math wakes and rebuilds only what a finished render changes - #1317
Merged
Merged
Conversation
…ender changes A finished render bumped one process-global generation that every math row and block put in its memo key, and woke one global waker. Past the cache's caps, finishing equation N evicted equation 1, every math row rebuilt, the evicted one missed and rendered again, and so on. A second window took the first one's waker, and any window at rest cleared every window's bitmaps. - Per row: math::collect notes the sources a row drew while they were still rendering, and math::version moves only when one of those finishes. Eviction never moves a version or wakes anyone. - The cache never evicts what is still rendering or what the last 16 commits drew; the caps (256 entries, 32 MiB) bound only what no view shows. - A full worker queue keeps the render waiting (up to 1,024) instead of showing code until something else rebuilds. - math::Client per window: its own waker and seen state; Client::rest clears bitmaps only once every window rests. - Markdown blocks holding display math no longer memoise (the equation's own element still does), so each row build asks the cache.
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.
Display math no longer wakes and rebuilds every math row each time any equation finishes. It rebuilds only the row that drew that equation, and the cache never evicts what is on screen or still rendering.
What was wrong (READER-11,
notes/review-rd-session.md)GENERATION. Every math row (rune-desktop'stimeline/mod.rs) and every settled Markdown block holding math (markdown/memo.rs) put it in its memo key.set_wakerkept one global waker: a second window took the first window's wake.rest()cleared every window's bitmaps whenever any window rested.What it does now
math::collect(key, build)notes the sources a row drew while they were still rendering, andmath::version(key)moves only when one of those finishes. Eviction never moves a version and never wakes anyone. A row showing a bitmap keeps its pixels; only a row that builds again asks for it anew.math::Client, one per window: its own waker and its own seen state.changed()returns true once per batch of finishes, for the host's poll.rest()clears bitmaps only once every window rests, andhold()undoes it.settled_math_card_digest).math::set_waker,math::generationandmath::restare removed.Client,collectandversionreplace them. rune-desktop is the only user, and its PR follows.Measured (rune-desktop with this change,
--profile perf, not PGO: not gate numbers; blade, Intel Iris Xe, 240 Hz, 1.5x)Fixture session, 15 s after opening, CPU (µs) and thread wakes per 5 s at rest, two rounds:
devd525338c)textNot proved here
dev-459): rune-desktop's PR carries the re-measure.Checks
tools/cargo.ps1 check -p rune-kit --features markdown,math --all-targets(farm): clean, one9d3159eand on the merge withdev(8283dca5).cargo check --target wasm32-unknown-unknown -p rune-kit --features markdown,math(farm): clean one9d3159e.