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

Webpack 5 triggers a slow V8 concat path resulting in significant performance degradation in some scenarios #14580

eoin opened this issue Oct 27, 2021 · 3 comments · Fixed by #14653


Copy link

eoin commented Oct 27, 2021

Early in Webpack 5 development the arrayToSetDeprecation helper was added to support migrating some objects from Array to Set. In order to maintain Array-like behaviour in concat the helper sets Symbol.isConcatSpreadable. On V8, setting Symbol.isConcatSpreadable anywhere puts all subsequent invocations of concat within an Isolate on a slow path.

There are cases where this can result in significant performance degradation. In this repro case, builds go from 1s with Webpack 4 to 16s with Webpack 5. We came across this when debugging this Linaria issue, where our production build slowed from ~10s to 2m+. I wonder if this could be the cause of some issues in #12102.

Copy link

sokra commented Oct 27, 2021

Oh interesting...

I wanted to add an option to opt out of deprecations anyway. Something like experiments.webpack4Compat: false. And they will be removed in webpack 6. So another reason to release that sooner than later...

Copy link

eoin commented Nov 18, 2021

For anyone who might be interested we did a writeup of how we tracked down this issue.

Copy link

zloirock commented Nov 20, 2021

@eoin deprecated versions of core-js (version < 3.3) cause the same problems, now about 20-25% (a little obsolete results of naive detection) of TOP 10000 websites use those deprecated core-js versions. It's @@isConcatSpreadable and (mainly) @@species feature detection, even without polyfilling. Workarounds of those V8 whims were added 2+ years ago, but who read deprecation notes?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging a pull request may close this issue.

4 participants