cujojs/when — pull request #155 by briancavalier (2013-06-12 20:30:38+00:00)
Title: Add Message channel scheduler

In working on #154, I discovered that the latency situation is pretty awful when we fall back to `setTimeout`. We're extremely fast at blasting through the promise callback queue and avoiding unnecessary subsequent "ticks" (and thus more latency), but there are execution scenarios where we simply cannot avoid ticking. In such scenarios, we take many big latency hits from `setTimeout`.

This is a very compact scheduler based on `MessageChannel` ... basically 3 additional LOC. It reduces the latency by around factor of 5 (!!) in WebKit, which, imho, is significant enough to offset the code size hit.