-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
es/minifier
: assignment of mangled names is order dependent, not usage
#10059
Comments
Actually this makes the gzipped size worse.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I have made a simple reproduction case with 100 functions, each used twice (to avoid inlining) and a single function which is used 100 times.
The function that is used over 100 times is assigned a longer name than a function that is only used twice, and thus wasting 98 bytes.
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.10.18&code=H4sIAAAAAAAAA%2B3WzWoUURBA4b1PMUuFIN66v7XwSSQLTQxmkRmQhCDiu4vapyVw9iL0qqAWh%2F5m%2Bs6du6fzzeP95Xy6fXp4%2BPbu9ZvT9x%2Bv7l4siy3DltWWzZbdlsOW05bLlqkP7yQ1FUUVVRVlFXUVhRWVFaUVtYXawr8vtYXaQm2htlBbqC3UFmqraqtqq%2F4yqq2qraqtqq2qraqtqq2pramtqa35SVNbU1tTW1NbU1tTW1dbV1tXW1db958RtXW1dbV1tXW1DbUNtQ21DbUNtQ3%2FjVTbUNtQ21DbVNtU21TbVNtU21Tb9AtAbVNtU21LbUttS21LbUttS21LbctvN7UttaXaUm2ptlRbqi3VlmpLtaVf3Zvt%2Bf58e3l%2B%2B%2FH0%2FvThzx%2BSq%2B0C3GZss26zbbNvc2xzbnNtM%2BnsQYqFZKFZiBaqhWyhWwgXykE59melHJSDclAOykE5KAflSrlSrvvHQLlSrpQr5Uq5Uq6UG%2BVGuVFu%2BydMuVFulBvlRrlR7pQ75U65U%2B77l0e5U%2B6UO%2BVOeVAelAflQXlQHvt7QXlQHpQH5Ul5Up6UJ%2BVJeVKe%2BytHeVKelBflRXlRXpQX5UV5UV7720x5UU7KSTkpJ%2BWknJSTclLO%2FaDkNafw03EKj1N4nMJ%2FdQr%2FXpGXxy%2Bfv764IG9%2BHc3f66vTMY7xn43rn68mQh52EgAA&config=H4sIAAAAAAAAA52VwXKjMAyG732KDOce2sPu7PQB9rbP4HGwIM4ai7FkGqaTd68w0LKJyGEvmaBPQui3JH88HQ7Vmerq7fAhf%2BWht4kgfT2LhcbI9iKWCurOUp18z9XzSs80IU4ZiuU6g4ptaoFLEP1YvKuASCC2xgaCxdb56Jtxm6%2FGrk9AtLGJVd6XO4hMS7bnLUr4rtiPiAFsfECMJeMjQwtJ8aoxBNsTmMHquBOxPKGWYYKZwZk%2BYa%2Fy6Dx7jCLFPXVgnanRgYJ8gpr9AFqY5JKwSFLdvzJ%2FYwfH3LblhG%2BiYbAhW1ZywqUciHztPTuhJzZN1kSY2Y4CM9Sl9Y1JwDkp%2Bc7o407UXwApP1iiaLuiz60CxaORVtqHD0N9bKRdeVS49LZWZYRWJDXeN4qukzKQ2GtnmcDlGiZh632q60DegYGmkT7R6Lvn%2BqSl5LEHbBQgh2u175%2FtZm%2F%2BFjyNwj79LQWy2lmLQ2f5tAtp7I6oTdAaDHxCt8%2FlBBh3aZLFcOl3cY4OpB%2FAaR6ZNPs0nGwYTSjL8a4fZCTkhaYNeFQXQy%2FNXY7u9WUxXr82cWdjW%2BZ%2BszUZ%2BwADhP8flodUPniY2nsd8VsnD78Uq4gne%2FP1ZUVrJU%2Frb6mp6tDlTT2lPecL5Wf17bReH2t5lac%2Fa2C5la6fjTfCXuQGAAA%3D
SWC Info output
No response
Expected behavior
The
other
function at the bottom should receive a one-letter name.Actual behavior
It receives a two letter name. Receiving a one letter name would save 98 bytes in this extreme example.
Version
1.10.18
Additional context
If the function declaration of
other
is moved to the top of the file, it receives a one-letter name.The text was updated successfully, but these errors were encountered: