Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minification: assume pure getters #37054

Closed
wants to merge 2 commits into from

Conversation

samouri
Copy link
Member

@samouri samouri commented Nov 24, 2021

summary
Partial for #36453

Assume all of our getters are pure in both our babel transforms and terser minification.

-  ✔ dist/v0.mjs    60.68 kb   –          218.51 kb  
+  ✔ dist/v0.mjs    60.42 kb   –          217.73 kb  

@samouri samouri self-assigned this Nov 24, 2021
@samouri samouri marked this pull request as ready for review November 24, 2021 21:51
@@ -570,6 +570,7 @@ async function minify(code, map) {
// Settled on this count by incrementing number until there was no more
// effect on minification quality.
passes: 3,
'pure_getters': true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit safer, and will keep things known to throw an error.

Suggested change
'pure_getters': true,
'pure_getters': 'strict',

Copy link
Member Author

@samouri samouri Nov 24, 2021

Choose a reason for hiding this comment

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

Thats actually the default value.
Maybe this is also resolvable within terser, as I'd expect something like Object.prototype.hasOwnProperty to be "known" not to throw, whereas currently it isn't DCEd

@stale
Copy link

stale bot commented Nov 23, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale Inactive for one year or more label Nov 23, 2022
@stale stale bot closed this Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Inactive for one year or more WG: performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants