-
-
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
Fix performance issue with setImmediate #619
Conversation
The naive implementation from the 'set-immediate-shim' package, based on setTimeout(..., 0) is order of magnitude slower than the clever ponyfill from core-js. See Stuk#617
For some reason, Maybe they are not defined for merge requests, but defined in builds on Running |
What about it https://github.com/YuzuJS/setImmediate? |
This library works fine and can be used in a webapp as a workaround / temporary fix for people using current versions of I wouldn't recommend adding it as a dependency to the IMHO, sticking to Moreover, |
Closing this as #829 has been merged and released. As stated above, the solution chosen in #829 is:
Keep this in mind if it could be a problem for you. |
Hi there,
As explained in issue #617, there's a serious performance issue in
generateAsync
since v3.2.0.After having run a comparison test (https://jsbin.com/kuxutodini/edit?html,console) and monitored the performance with Chrome's Javascript Profiler, I noticed repeated pauses during which the browser does nothing.
I found the culprit to be a change introduced in 5566c95 from MR #532.
The set-immediate-shim introduced is a very naive implementation using the
setTimeout(..., 0)
trick, whereas thecore-js
ponyfill used before is more subtle, e.g. usingMessageChannel
in browsers (as explained on MDN).setImmediate
is used extensively in the code base, and this change alone made the performance drop significantly in browsers.This MR is a partial revert of 5566c95, but with a recent version of
core-js-pure
instead of the oldercore-js
used before. With,core-js-pure
we're guaranteed to use a ponyfill (not a polyfill polluting the global environment) as explained here.The resulting file sizes in
dist/
folder are a little bigger, but I think this is totally acceptable: