Skip to content

web state: memoized rows, in-place row patches, keyed moves without a full render - #4239

Merged
BaseMax merged 9 commits into
mainfrom
web-row-slot-keys
Nov 25, 2026
Merged

BaseMax merged 9 commits into
mainfrom
web-row-slot-keys

Conversation

@BaseMax

@BaseMax BaseMax commented Nov 25, 2026

Copy link
Copy Markdown
Member

A list re-render used to rebuild every row's html, parse the whole region and reconcile it. Now:

  • Rows reach the runtime as a list instead of one marked-up string. Each row is keyed by the values of its dynamic parts; a row whose values did not change reuses its html and is not built, escaped or compared again.
  • When only some rows changed, they are patched in place. A change to one text or one attribute value is written straight into that node; anything else is parsed in one batch and patched.
  • When rows move, appear or go, kept rows stay as they are, only new or changed rows are parsed, and the fewest rows move. Unchanged ends of the list are skipped.
  • Row slots are keyed by the row key, so a removed row no longer shifts every later row's data. A stateful component in each _, it no longer crashes with _ is not defined.

1000 rows in Chromium, ms of work per click (JS and layout, best of 25 runs, two runs on a busy machine), main / this (React 18 with memo rows):

  • create 1000: 23-33 / 20-22 (18-20)
  • append 1000: 24-29 / 23-24 (19-26)
  • select a row: 1.7-2.5 / 0.4-0.5 (0.2-0.3)
  • update every 10th: 4.0-5.5 / 1.6-1.8 (1.1-1.3)
  • swap two rows: 2.0-2.3 / 0.7-0.8 (17-24)
  • remove a row: 1.8-2.0 / 0.8-0.9 (0.3-0.6)

test-page-keyed.js checks row counters through reverse and drop and an unkeyed stateful list; the new test-page-keyed-inplace.js checks that picks, renames, reverse, insert and drop keep every row element, that typed values survive, that labels with markup characters stay text, and that these renders skip the full path.

@BaseMax
BaseMax requested a review from a team as a code owner November 25, 2026 16:36
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bcfe2958-4903-4d28-ace9-117621da8b78
Commits

Reviewing files that changed from the base of the PR and between 611523b and b4892c3.

Files selected for processing: 10

  • .github/workflows/ui-pr-gate.yml
  • compiler/interp/interp_ffi.salam
  • compiler/sal_layout/layout_ssr.salam
  • compiler/sal_layout/layout_webstate.salam
  • tests/en/page/components/component_state_list.salam
  • tests/en/page/components/keyed_inplace.salam
  • tests/en/page/components/keyed_moves.salam
  • tests/fa/page/components/component_state_list.salam
  • tools/js/test-page-keyed-inplace.js
  • tools/js/test-page-keyed.js
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@BaseMax
BaseMax merged commit 73fad9f into main Nov 25, 2026
27 checks passed
@BaseMax
BaseMax deleted the web-row-slot-keys branch November 25, 2026 18:18
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.

1 participant