Skip to content

fix(runtime): dedupe DOMElements set literal (286 entries, 149 unique) - #543

Merged
ryansolid merged 2 commits into
nextfrom
dedupe-dom-elements
Jul 15, 2026
Merged

ryansolid merged 2 commits into
nextfrom
dedupe-dom-elements

Conversation

@ryansolid

Copy link
Copy Markdown
Owner

The DOMElements array concatenated a categorized list with a full alphabetical list, shipping 286 entries where only 149 are unique — ~1,056 bytes minified (266 gzip) in any bundle that retains the set (star-import, CDN, non-tree-shaken consumers; tree-shaken apps already drop it via the /*#__PURE__*/ annotation).

Membership is provably unchanged: sha256 of the sorted unique member list is identical before and after (7ff448dbd2015bd9), and consumers only ever call .has() — verified no iteration/spread of the set anywhere in this repo or solid.

Part of the solidjs/solid#2883 size work (phase 2).

All 569 runtime tests pass.

🤖 Generated with Claude Code

The array concatenated a categorized list with a full alphabetical list;
membership is unchanged (sha256 of sorted unique members identical before
and after). Saves ~1KB minified wherever the set is retained.

Co-Authored-By: Claude Fable 5 <[email protected]>
@cursor

cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@changeset-bot

changeset-bot Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 18d3380

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

This PR includes changesets to release 5 packages
Name Type
@dom-expressions/runtime Patch
@dom-expressions/babel-plugin-jsx Patch
@dom-expressions/hyperscript Patch
@dom-expressions/tagged-jsx Patch
@dom-expressions/jsx-compiler 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

Smaller than the deduped array literal (1180->893 min, 571->536 gz) with
the same Set<string> public surface. Both the Set construction AND the
inner .split() carry /*#__PURE__*/ — without the inner annotation,
bundlers cannot prove the argument expression pure and retain the whole
declaration even when unused (verified with esbuild).

Other constant sets measured and left as array literals: across all six
the same encoding saves 252 min bytes and exactly 1 gzip byte total,
with the small sets regressing (the .split wrapper outweighs the quotes).

Co-Authored-By: Claude Fable 5 <[email protected]>
@ryansolid
ryansolid merged commit dce338a into next Jul 15, 2026
2 checks passed
@ryansolid
ryansolid deleted the dedupe-dom-elements branch July 15, 2026 20:39
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