You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use setImmediate if you want to queue the function behind whatever I/O event callbacks that are already in the event queue.
Use process.nextTick to effectively queue the function at the head of the event queue so that it executes immediately after the current function completes. It's slightly faster than setTimeout:
'use strict'
var bench = require('fastbench')
var run = bench([
function benchSetImmediate (done) {
setImmediate(done)
},
function benchNextTick (done) {
process.nextTick(done)
}
], 1024 * 1024)
// run them two times
run(run)
Considerations on browser side
on browser side, setImmediate/process.nextTick is not available.
A simple solution is setTimeout(fn, 0).
The text was updated successfully, but these errors were encountered:
Use setImmediate if you want to queue the function behind whatever I/O event callbacks that are already in the event queue.
Use process.nextTick to effectively queue the function at the head of the event queue so that it executes immediately after the current function completes. It's slightly faster than setTimeout:
Considerations on browser side
setTimeout(fn, 0)
.The text was updated successfully, but these errors were encountered: