Improve Promise implementation performance
Edge's Promises are a lot slower than the implementations in other browsers. This causes severe problems in Promise heavy APIs.
Here is a fiddle that demonstrates the issue: https://jsfiddle.net/jdanyow/vj6o119n/
In Chrome this executes in 1m - 4ms.
In Edge it takes around 3500ms
This shipped today with EdgeHTML14, as part of the Windows 10 Anniversary update.
Ashley Grant commented
I just tested this in the build running on my Fast-ring desktop (37.14332.1001.0). The elapsed time is fluctuating between 4 and 13 ms while Chrome 50 is 2.25-6 ms on the same machine. So great work! Now, let's beat the Chrome team :-)
Bluebird uses MutationObserver:
And fails over to setImmediate when MutationObserver is not available:
Drew Marsh commented
Yeah, I think the Promise API should really use the setImmediate API under the covers instead of setTimeout as setTimeout is throttled.
Here's a fork of Jeremy's sample jsfilddle that uses setImmediate when it detects the specified timeout value is 0 and you can see it executes is 25ms-41ms for me vs the many seconds of the original sample: https://jsfiddle.net/dmarsh/ge5g28ru/