-
Notifications
You must be signed in to change notification settings - Fork 48
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
Use async/setImmediate instead of async/nextTick #196
Comments
Sure, please go ahead and make a PR. Thank you |
Note that even if I change to I will make a PR. |
Please use The NearForm team did a whole bunch of performance analysis of our code base at the beginning of the year and this was one of their findings - their recommendation was to avoid creating latency like this wherever possible. |
@achingbrain I understand. For me this is actually a webpack problem because its process.nextTick polyfill relies on setTimeout, which run once each 1sec if tab is not focused/active. The sad reality is that most people using IPFS in the browser will experience the slowness I was experiencing while webpack doesn't fix their polyfill. I had the will to pinpoint the problem and it took me 3 hours, but most people won't and will just give up. Feel free to close #197. I've opened an issue on Webpack: webpack/node-libs-browser#92 I will keep the aliasing on my part to get around the issue. |
Ok thanks @achingbrain for your input, I didn't know that. I will go ahead and close this issue and the PR as it sounds like the fix should be made in Webpack and @satazor has opened an issue with them. |
I've noticed that this module is using
async/nextTick
instead ofasync/setImmediate
. Usingasync/setImmediate
is preferred due to the wayasync/nextTick
works in the browser:Because timers are often throttled when a tab is not active to improve battery life, they only run at 1Hz (once every second). This has a drastic performance impact in those scenarios.
Will you accept a PR to change this?
Meanwhile, I'm aliasing
async/nextTick
toasync/setImmediate
in my webpack config.The text was updated successfully, but these errors were encountered: