-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
perf(es/minifier): check whether a function is pure with O(1) cost #6840
Conversation
1365c19
to
3b8f5ca
Compare
Can we have those list also in swc minifier? (itself) |
Absolute yes. I would do it in another PR. We might need to provide an option(enable by default) to disable it. Because users might do some hacky things to the environment. |
We have |
Get it. |
@kdy1 we might need something like |
I think we can use a hash set of |
Yes. Dealing |
The wasm test due to net work. |
Expr::Member(i) => { | ||
Self(&i.obj).hash(state); | ||
if let MemberProp::Ident(prop) = &i.prop { | ||
prop.sym.hash(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a bug here that console.log
will hash the same as the identifier consolelog
. We'd need to hash "."
or similar sigil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it matter? Eq
will be used if the hash value matches
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhhhhh.
Expr::Member(i) => { | ||
Self(&i.obj).hash(state); | ||
if let MemberProp::Ident(prop) = &i.prop { | ||
prop.sym.hash(state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhhhhh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
swc-bump:
- swc_ecma_minifier
Description:
We might need to pass a giant pure function list to the SWC minifier as esbuild did here.
The current implementation could slow the minifier.
BREAKING CHANGE:
Related issue (if exists):