Skip to content

memo: a subtree with live values reuses its flattened nodes whole - #843

Merged
Hona merged 1 commit into
devfrom
reuse-live
Nov 12, 2026
Merged

Hona merged 1 commit into
devfrom
reuse-live

Conversation

@Hona

@Hona Hona commented Nov 12, 2026

Copy link
Copy Markdown
Member

Summary

  • A memo whose subtree holds live values (El::live, a scroll bar's thumb, a bound offset) can reuse its flattened nodes whole (memo::el_flatten_reusable).
  • A reused node carries its bindings, and subscribe_live attaches every node's bindings after each commit, so the values keep driving it.
  • One behaviour kept: a commit that lands drops a rebuilt node's latches (Bound::seen). Reused nodes now get the same reset, in apply.
  • Live text (text.live) still refuses reuse, unchanged.

Why

  • OpenCode's timeline region holds the session's scroll bar, whose thumb is a live value. So the region never reused its nodes, even when a keystroke left it unchanged.
  • On its own this changes no typing number. The timeline also holds a virtual list, which the next PR handles. Together they take the typing commit from about 1,465 to 1,150 µs.

Checks

  • All 95 OpenCode fixture scenes, light and dark, before and after on the same base: PNGs and element trees byte-identical. The draft scenes' trees differ between two runs of the old build too.
  • 120 snapshots mid-interaction (typing, timeline scroll, selection, side panel; session, streaming and busy scenes; two fixtures), before and after: pixel-identical.
  • Debug soaks: 30 runs, no region warnings or panics.
  • cargo check -p rune --all-targets. Rune's tests run in CI.

Copilot AI balanced review requested due to automatic review settings November 12, 2026 23:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@Hona
Hona merged commit 726ccc3 into dev Nov 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants