Skip to content

perf: annotate module-level Object.freeze calls as pure - #200

Merged
Rich-Harris merged 1 commit into
sveltejs:mainfrom
danielroe:perf/pure-freeze
Sep 18, 2026
Merged

Rich-Harris merged 1 commit into
sveltejs:mainfrom
danielroe:perf/pure-freeze

Conversation

@danielroe

Copy link
Copy Markdown
Contributor

I noticed this whilst trying to optimise nuxt client bundle size.

on the client, we only ever call parse but noticed that we still had default_stringify_operations and everything it references, including toISOString, unbox, toPromise and typeOf.

this matches the annotation already on object_proto_names in src/utils.js.

the result seems good:

raw gzip
before 5.6 kB 2155 B
after 4.1 kB 1611 B

🔥

@changeset-bot

changeset-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4d84a8b

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

This PR includes changesets to release 1 package
Name Type
devalue 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

@Rich-Harris Rich-Harris left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@Rich-Harris
Rich-Harris merged commit 067b125 into sveltejs:main Sep 18, 2026
6 checks passed
@danielroe
danielroe deleted the perf/pure-freeze branch September 18, 2026 19:33
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.

2 participants