-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
_.defer and process.nextTick under node.js #978
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
Conversation
|
|
|
How about this decision flow:
|
|
Hmm, I'd prefer _.defer(function next() {
// ...
_.defer(next);
}); |
|
|
|
Is there something holding back this PR? |
|
Just general slowness. Since the |
|
I agree. Would it be more acceptable if we just tried to detect if |
|
Probably not, given the MDN note:
I think Underscore would be wise to just stay out of it, and let you optimize further if you wish. |
Really simple improvement to use
process.nextTickinstead ofsetTimeoutunder Node.js. Quick benchmarks show that the incurred overhead of the current implementation (usingsetTimeout(fn, 0)) varies between 600 µs to 1.2 ms. With the current improvement, it varies between 200 µs to 450 µs.After a few years in production, that could potentially save us 1 or 2 seconds! :)