Skip to content

Run-length encode scope-ref lists and repeated fills in the resume payload - #3352

Open
DylanPiercey wants to merge 1 commit into
mainfrom
resume-fill-run-encoding
Open

Run-length encode scope-ref lists and repeated fills in the resume payload#3352
DylanPiercey wants to merge 1 commit into
mainfrom
resume-fill-run-encoding

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

Description

Loop-heavy pages serialize O(n) bookkeeping per iteration: branch-scope lists ([_(2),_(3),…,_(201)]), closure subscriber sets, and identical per-branch fills ({_:_(1)} repeated). Branch scope ids allocate contiguously, so these are arithmetic runs:

  • Arrays/Sets that are entirely scope references with a constant id step serialize as _.s(from,count[,step]) (≥3 items).
  • A scope fill textually identical to the previously emitted one collapses into a negative repeat token in the fill array ({_:_(1)},-199), which the resume runtime expands into per-scope copies. Collapse is purely textual and post-hoc — refs/channel side effects already ran — and is disqualified whenever a fill writes anything identity- or position-sensitive (newly tracked objects, scope-bound registered calls), so distinct-but-equal objects are never aliased.

Measured on a 200-item <for> reading a parent <let>, the resume script drops from ~5.6 KB to roughly constant size for the bookkeeping portion. The decoder additions cost ~150 B min in the shared runtime.

Checklist:

  • I have read the CONTRIBUTING document and have signed (or will sign) the CLA.
  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

Generated by Claude Code

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6fd8bd0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@marko/runtime-tags Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.29%. Comparing base (9849a13) to head (6fd8bd0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3352      +/-   ##
==========================================
- Coverage   94.29%   94.29%   -0.01%     
==========================================
  Files         388      388              
  Lines       53085    53180      +95     
  Branches     4237     4246       +9     
==========================================
+ Hits        50058    50147      +89     
- Misses       2998     3003       +5     
- Partials       29       30       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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