Skip to content

perf(runtime-tags): let a conditional bound its own section - #3711

Closed
DylanPiercey wants to merge 1 commit into
mainfrom
dpiercey-ws-octane-benchmark-ic5yl7-anchorless
Closed

perf(runtime-tags): let a conditional bound its own section#3711
DylanPiercey wants to merge 1 commit into
mainfrom
dpiercey-ws-octane-benchmark-ic5yl7-anchorless

Conversation

@DylanPiercey

@DylanPiercey DylanPiercey commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

A section whose only content is an <if> chain was still emitting boundary markers and an anchor to delimit a range the conditional's own branch already bounds — three comment nodes per item for a <for> over a conditional. The section now emits none of them, and the rendered branch is the section's range; on each swap the conditional retargets any owner still holding the replaced range. When the chain renders nothing its anchor bounds the section instead, so this covers a chain with no <else> as well.

Worth ~12% on rebuilding a large keyed list, and removes every comment marker the conditional produced (42 to 0 in a chat-style fixture, matching a markerless framework's node count exactly). Costs +84 bytes brotli.

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4f6aeaa

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 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.35%. Comparing base (3ba2287) to head (4f6aeaa).

Files with missing lines Patch % Lines
packages/runtime-tags/src/dom/control-flow.ts 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3711      +/-   ##
==========================================
+ Coverage   90.34%   90.35%   +0.01%     
==========================================
  Files         414      414              
  Lines       19746    19767      +21     
  Branches     3615     3626      +11     
==========================================
+ Hits        17840    17861      +21     
  Misses       1367     1367              
  Partials      539      539              

☔ 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.

A conditional that is a section's only content already has well defined
bounds, so the section emits no markers or anchor and the rendered branch
is its range. Owners holding the replaced range follow it on each swap.
While the conditional renders nothing its anchor bounds the section, so a
missing `<else>` needs no markers either.

Measured ~12% off rebuilding a large keyed list, and drops every comment
marker the conditional produced (42 to 0 in a chat fixture).
@DylanPiercey
DylanPiercey force-pushed the dpiercey-ws-octane-benchmark-ic5yl7-anchorless branch from a7553fc to 4f6aeaa Compare July 30, 2026 17:24
@DylanPiercey

Copy link
Copy Markdown
Contributor Author

Superseded by #3712, which gates the same two getSectionMeta lines on a strictly weaker condition (any if/for/dynamic tag at a section edge, rather than an exhaustive conditional as the whole content), so every shape this elides is elided there too — verified by compiling this PR's own target shape on both branches. #3712 also drops the leftover leading over(1) walk step this leaves behind, and extends the same owner-retargeting walk to <for>, <show>/<await>/<try>, lazy tags and the resume path.

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