JavaScript Promise/Defer in Chrome JavaScript Promise/Defer in Chrome google-chrome google-chrome

JavaScript Promise/Defer in Chrome


You are creating unnecessary function objects.

You can just do:

var defer = function() {    var result = {};    result.promise = new Promise(function(resolve, reject) {        result.resolve = resolve;        result.reject = reject;    });    return result;};

Design flaw is doing this in the first place, native promises are useless if you are using Q.


See http://bluebirdjs.com/docs/benchmarks.html for benchmarks. There are some JSPerf benchmarks as well, however "for a reasonably fast promise implementations latency is going to be fully determined by the scheduler being used and is therefore not interesting to benchmark. JSPerfs that benchmark promises tend to benchmark latency."