Repository navigation
fix(memo): flatten-reuse memos holding LiveText without reshaping unchanged values - #2105
Merged
Merged
Conversation
This was referenced Nov 25, 2026
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.
Refs #2084
Root cause
el_flatten_reusableincrates/rune/src/memo/built.rsrequiredt.cold.live.is_none(), preventing anymemoholding aLiveTextfrom flatten-reusing its nodes across commits. Every unrelated commit rebuilt the memo's static tags and containers with fresh paint epochs, leavingPaintKeepwith 0 copied nodes on commit frames.try_reuse_memo(crates/rune/src/runtime/commit/memo_reuse.rs),relayout, andremountalso clearedtext_layout: Noneandelided: Noneon reused nodes, which would causesolveto re-shape latchedLiveTextcontent into the shared commit layout cache during commit and then shape again inlatch_live.What changed
crates/rune/src/memo/built.rs: removedt.cold.live.is_none()fromel_flatten_reusable.crates/rune/src/runtime/commit/memo_reuse.rs,relayout.rs,remount.rs: preservedtext_layoutandelidedacross reuse forLiveTextnodes.crates/rune/src/runtime/commit/relayout.rs,measure.rs,remount.rs: passedreusedspans intoMeasurement::solve. For reusedLiveTextnodes whose layout is still valid (not width-sensitive, or unchanged content width at the same scale),solveskipslay_out_text; when width changes or layout was cleared, latchedLiveTextnodes re-lay out vialay_out_text_inner(..., true)and bumpnode.epochwithout polluting the commit layout or elision caches.crates/rune/src/runtime/commit/text_layout.rs: incompute_layout, reused non-wrapped un-elidedLiveTextlayouts directly and routed latchedLiveTextmeasurement throughlayout_live_spec.crates/rune/src/runtime/memo_reuse_live_text_tests.rs: added regression tests covering flatten reuse, static sibling epoch preservation, single-shape tick commits, wrapped/truncated/clamped same-width reuse, container resize relayout, rebased (!same_path) reuse, and accessibility tree parity.changelog/unreleased/2026-11-25-memo-reuse-live-text.md: changelog entry.Headless
--profile perfmeasurement (500LiveTextcells, 5 paired alternating runs, 240 frames)Headless
RuntimeCPU only (excludes GPU upload and presentation); measured against baseline without Part 2 to isolate Part 1.RUNE_PAINT_KEEP_LOG=1)Verification
cargo test -p rune --lib -- memo_reuse memo::tests relayout remount live_latch live_text(93 passed, 0 failed).scripts/file-size.sh: 0 errors.devincluding fix(paint): allow paint keep to copy unchanged LiveText nodes across frames #2094):cargo test -p rune --lib -- memo_reuse::live_text_tests runtime::paint::keep(3 passed, 0 failed) andcargo clippy -p rune --lib --bins --tests(0 errors).cargo check -p rune -p rune-kit --tests(exit 0).