-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Massive performance regression on 5.71.0 during initial script execution. #15885
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
Comments
Can yiu check it without minification? THere are many places, babel with core-js and polyfills and some polyfills can ahve regression, terser can change ouput and it can be bad for perf, typescript can generate other code, without reproducible repo hard to help you, sorry |
@alexander-akait We just confirmed that without minification and when bundling in dev mode, the bundles are exactly the same. I think we isolated the problem The usage of the arrow function seems to be causing the issue. My guess is that the browser is moving over a massive bit of context and that ends up being a bottleneck on load. Just changing the arrow function to a normal function removed the perf issue. I'm not sure how webpack optimization does this and why, but it appears to be the problem. |
@jljorgenson18 You faced with it #13125, I recommend to disable arrow functions on your side (https://webpack.js.org/configuration/output/#outputenvironment, set |
@alexander-akait The problem isn't the overall usage of arrow functions, it's the arrow function that wrap all of the module code. That part is what seems slow and if I had to guess, it's probably due to forwarding the context. This also seems to specific to webpack optimization code and it isn't a problem with the internal webpack code generally. This happens on I sincerely doubt we are the only project experiencing this and I can try to find a large open source project tomorrow that is also having this occur. I would expect this to have a negative effect on any large bundle. This was already a tiny optimization related making bundles just the tiniest bit smaller so I think the right course of action is just to revert the change. That being said, I do think it probably makes sense to report to this to Webkit and Chromium Edit: We didn't actually confirm it happened on Safari yet |
could you provide both profiles without arrow function and with it? |
@vankop My screenshots in the initial post show the performance profile times. Do you want them exported some other way and do you want a working example from an open source project? |
Is there a workaround for this issue? Is it an issue with UMD output only? |
@Rush set |
Could you also test with wrapping the section with Having a debugger attached can slow down specific kind of code considerably because the browser has to keep the context of functions in case you halt the program. If |
Sorry for the delay. @sod using what you suggested, I confirmed that the issue is still definitely there. Currently on our bundle without minification, bootstrap takes about 160ms with arrow functions and about 120ms without if you completely wrap the entire bundle. This is a really simple fix if you just remove arrow functions from the top wrapping UMD function during minification |
Just checked with minification and by using the arrowFunction output environment config. I am seeing about 55ms for bootstrap with arrow functions set to false and about 130ms with arrow functions set to true |
@jljorgenson18 I wrote about it here above (#13125) |
@alexander-akait right, but this is a special case of that issue. An optimization was added here 806ee08 which caused an even worse regression for large UMD bundles. |
@jljorgenson18 I think we should report about it to v8 bug tracker, that is really bad for JS ecosystem, not only for webpack |
This issue had no activity for at least three months. It's subject to automatic issue closing if there is no activity in the next 15 days. |
Issue was closed because of inactivity. If you think this is still a valid issue, please file a new issue with additional information. |
Hi,
I do not have a minimal repro case yet but just as an fyi, we are seeing a massive regression on our initial script execution when going from webpack version 5.70.0 to 5.71.0. Feel free to close this issue if there is no action to be had but our main bundle went from taking 38ms to execute all the way to 97ms. On mobile iOS, it's even worse.
I dug through the release notes and haven't been able to pinpoint the cause but I may try to update this ticket if I can find the culprit.
A few comments about our webpack config
I'll update this ticket if I find anything else
The text was updated successfully, but these errors were encountered: