@mafintosh asks: "Does anyone have a good code example of when to use setImmediate instead of nextTick?"
https://twitter.com/mafintosh/status/624590818125352960
The answer is "generally anywhere outside of core".
process.nextTick
is barely asynchronous. Flow-wise it is asynchronous, but it will trigger before any other asynchronous events can (timers, io, etc.) and thus can starve the event loop.
In this script I show a starved event loop where I just synchronously block, use nextTick
and setImmediate