Davy Jones Promises/A+ Benchmark

JavaScript performance comparison

Test case created by John Yanarella

Preparation code

<script src="https://rawgithub.com/petkaantonov/bluebird/master/js/bluebird.js">
</script>
<script>
window.Bluebird = {
  Promise: Promise
};
</script>

<script src="https://rawgithub.com/kriskowal/q/master/q.min.js"></script>

<script>
    window.define = function(factory) {
        try{ delete window.define; } catch(e){ window.define = void 0; } // IE
        window.when = factory();
    };
    window.define.amd = {};
</script>
<script src="https://rawgithub.com/cujojs/when/master/when.js"></script>

<script src="https://rawgithub.com/dfilatov/jspromise/master/lib/vow.js"></script>

<script src="https://rawgithub.com/CodeCatalyst/promise.coffee/master/promise.js"></script>

<script src="https://rawgithub.com/lvivski/subsequent/master/subsequent.js"></script>
<script src="https://rawgithub.com/lvivski/davy/master/davy.js"></script>
<script>
Benchmark.prototype.setup = function() {
    function addOne(x) {
      return x + 1;
    }
   
    Q.longStackJumpLimit = 0;
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Bluebird
// async test
var d = Bluebird.Promise.pending();
d.promise.then(addOne).then(function(value){
  deferred.resolve();
});
d.fulfill(1);
pending…
Q
// async test
// async test
var d = Q.defer();
d.promise.then(addOne).then(function(value){
  deferred.resolve();
});
d.resolve(1);
pending…
when.js
// async test
// async test
var d = when.defer();
d.promise.then(addOne).then(function(value){
  deferred.resolve();
});
d.resolve(1);
pending…
Vow
// async test
var p = Vow.promise();
p.then(addOne).then(function(value) {
  deferred.resolve();
});
p.fulfill(1);
pending…
Promise.coffee
// async test
// async test
var d = new Deferred();
d.promise.then(addOne).then(function(value){
  deferred.resolve();
});
d.resolve(1);
pending…
Davy Jones
// async test
var p = new Promise();
p.then(addOne).then(function(value) {
  deferred.resolve();
});
p.fulfill(1);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment