Skip to content

perf: optimize dynamic closure serialize index#3148

Merged
DylanPiercey merged 1 commit intomainfrom
opencode/mighty-mountain
Apr 2, 2026
Merged

perf: optimize dynamic closure serialize index#3148
DylanPiercey merged 1 commit intomainfrom
opencode/mighty-mountain

Conversation

@DylanPiercey
Copy link
Copy Markdown
Contributor

Avoid serializing dynamic closure signal indexes for the first dynamic closure.

@DylanPiercey DylanPiercey self-assigned this Mar 31, 2026
@github-project-automation github-project-automation bot moved this to Todo in Roadmap Mar 31, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: 54ffcb2

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e3ee2c73-3b62-4b23-9d57-f74a9f910a7d

📥 Commits

Reviewing files that changed from the base of the PR and between 56f0896 and 54ffcb2.

⛔ Files ignored due to path filters (107)
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-event-handler-render-body-tags-to-class/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-event-handler-render-body-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-event-handler-render-body-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-nested-tags-to-class/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-nested-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-nested-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-tag-params-tags-to-class/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-tag-params-tags-to-class/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures-interop/interop-tag-params-tags-to-class/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/async-deep-recursive/__snapshots__/html.expected/tags/recurse.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/async-state/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/async-state/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/async-state/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/at-tags-for-loop-param-intersection-closure/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/at-tags-for-loop-param-intersection-closure/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/at-tags-for-loop-param-intersection-closure/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-cleanup/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-cleanup/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-cleanup/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-closure-function/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-closure-function/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-closure-function/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-closure/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-closure/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-closure/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-tag/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-tag/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-tag/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-update-after-resume/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-update-after-resume/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-update-after-resume/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-update-before-resume/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-update-before-resume/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/await-update-before-resume/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-component-renderBody/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-layout/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-params/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-params/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-params/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-custom-tag/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/basic-nested-scope-dynamic-tag/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/bind-to-input/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/bind-to-input/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/bind-to-input/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/body-content/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/body-content/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/body-content/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-deep/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-deep/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cleanup-n-child-if-deep/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cleanup-single-child-if-deep/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cleanup-single-child-if-deep/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cleanup-single-child-if-deep/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cross-tag-closure/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cross-tag-closure/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/cross-tag-closure/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/define-tag-render-closure/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/define-tag-render-closure/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/define-tag-render-closure/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/destructure-input-with-assignment/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/destructure-input-with-assignment/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/destructure-input-with-assignment/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-closure-multiple/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-closure-multiple/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-closure-multiple/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-closure-with-function/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-closures/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-closures/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-closures/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-content-attr/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-content-attr/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-content-attr/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-tag-var-in-body/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-tag-var-in-body/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/dynamic-tag-var-in-body/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/error-custom-tag-own-body-read-before-return/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/hoist-only/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/input-missing-property/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/input-property-alias-closure/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/namespaced-tags/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/nested-for-if-stateful/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/param-destructure-dynamic-default/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/param-destructure-dynamic-default/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/param-destructure-dynamic-default/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/return-tag-bind-type-casting/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/return-tag-bind-type-casting/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/return-tag-bind-type-casting/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/spread-to-known-rest-input-with-attr-tags-deopt/__snapshots__/html.expected/tags/wrap.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/toggle-nested-2/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/toggle-nested-2/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/toggle-nested-2/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/toggle-nested-3/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/toggle-nested-3/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/toggle-nested-3/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/toggle-nested/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/try-effects-async/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/try-effects-async/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/try-effects-async/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/try-effects-catch-state/__snapshots__/html.expected/template.js is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/try-effects-catch-state/__snapshots__/resume.expected.md is excluded by !**/__snapshots__/** and included by **
  • packages/runtime-tags/src/__tests__/fixtures/try-effects-catch-state/__snapshots__/ssr.expected.md is excluded by !**/__snapshots__/** and included by **
📒 Files selected for processing (6)
  • .changeset/strong-regions-wonder.md
  • .sizes.json
  • .sizes/dom.js
  • packages/runtime-tags/src/dom/signals.ts
  • packages/runtime-tags/src/translator/util/references.ts
  • packages/runtime-tags/src/translator/util/signals.ts
✅ Files skipped from review due to trivial changes (4)
  • .changeset/strong-regions-wonder.md
  • packages/runtime-tags/src/dom/signals.ts
  • .sizes.json
  • packages/runtime-tags/src/translator/util/references.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .sizes/dom.js

Walkthrough

This pull request prevents serializing dynamic closure signal indexes for the first dynamic closure. The runtime _closure now falls back to closure signal index 0 when the stored index is falsy/undefined. Compiler changes only add and set the ClosureSignalIndex serialization reason when the computed dynamic closure index is truthy. Precomputed size metadata was updated (minified increased slightly, Brotli decreased). A changeset was added to bump the runtime-tags package at patch level.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: optimizing dynamic closure serialization by avoiding unnecessary serialize index operations.
Description check ✅ Passed The description is directly related to the changeset, explaining that the optimization avoids serializing dynamic closure signal indexes for the first dynamic closure.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch opencode/mighty-mountain

Comment @coderabbitai help to get the list of available commands and usage tips.

@DylanPiercey DylanPiercey force-pushed the opencode/mighty-mountain branch from 0e981da to dac89f0 Compare March 31, 2026 22:38
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.57%. Comparing base (9ddb449) to head (54ffcb2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3148   +/-   ##
=======================================
  Coverage   89.57%   89.57%           
=======================================
  Files         370      370           
  Lines       47080    47086    +6     
  Branches     4269     4271    +2     
=======================================
+ Hits        42171    42177    +6     
  Misses       4857     4857           
  Partials       52       52           

☔ View full report in Codecov by Sentry.
📢 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.

@DylanPiercey DylanPiercey force-pushed the opencode/mighty-mountain branch from 56f0896 to 54ffcb2 Compare April 2, 2026 17:44
@DylanPiercey DylanPiercey merged commit 9874646 into main Apr 2, 2026
11 checks passed
@DylanPiercey DylanPiercey deleted the opencode/mighty-mountain branch April 2, 2026 18:08
@github-project-automation github-project-automation bot moved this from Todo to Done in Roadmap Apr 2, 2026
@github-actions github-actions bot mentioned this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant