Skip to content

perf(runtime-tags): return the side of a sorted union that holds the other - #4522

Merged
DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-persisted-pages-xh8764-main-fixes.union-identity
Oct 24, 2026
Merged

DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-persisted-pages-xh8764-main-fixes.union-identity

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

The reasons solve merges sorted sets on every pass, and since reasons only grow, most of those merges add nothing. union still built a copy whenever one side already held the other, so each no-op merge allocated and re-ran the param alias filter, whose merged === a shortcut almost never fired. In deeply nested <if>s that filter dominated the compile.

union now returns the side that already holds the other, the same identity rule filter and difference follow; a's item still wins a tie. Compiled output is unchanged. On the bundled build, <if>s nested 50/100/200 levels deep compile 35%/48%/58% faster, and the fixtures compile within noise.

🤖 Generated with Claude Code

…other

A union of two sorted lists returned an input only when both held the same
items, and built a copy whenever one held the other. Reasons only grow, so
most merges in the reasons solve add nothing, yet each one allocated and
re-ran the param alias filter, whose `merged === a` shortcut almost never
fired. In deeply nested `<if>`s that filter dominated the compile.

A union now returns the side that already holds the other, as `filter` and
`difference` return their input when nothing drops. `a`'s item still wins a
tie, so `b` stands for the union only where it holds `a`'s very items.

Compiled output is unchanged. On the bundled build, a template nesting `<if>`
50/100/200 levels deep compiles 35%/48%/58% faster; the fixtures compile
within noise.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d5d5fd4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@DylanPiercey
DylanPiercey merged commit 7b2472a into main Oct 24, 2026
8 checks passed
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.86%. Comparing base (5e6feb8) to head (d5d5fd4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4522   +/-   ##
=======================================
  Coverage   94.86%   94.86%           
=======================================
  Files         419      419           
  Lines       20902    20906    +4     
  Branches     4173     4176    +3     
=======================================
+ Hits        19828    19832    +4     
  Misses        617      617           
  Partials      457      457           

☔ 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