defunctzombie/node-process — pull request #25 by devongovett (2014-11-22 03:23:35+00:00)
Title: Speed up nextTick in web workers

I've been working on some streaming image processing, and I was debugging why it was running 10 times slower in web workers than on the main thread. I did some profiling and saw lots of what looked like idle time. After a few days I figured it out: the node stream module calls process.nextTick a lot and it was falling back to `setTimeout` inside web workers since mutation observers and postMessage are not supported there.

This PR adds three async yielding methods that are supported by workers in various browsers, in order of speed according to http://jsperf.com/setimmediate-test/17. They are: `Object.observe` (fastest by far in Chrome), native `Promise` (fastest in Firefox and new Safari), and `MessageChannel` (old Chrome and Safari).