promise comparisons (v101)

Revision 101 of this benchmark created on


Description

This is a comparison of different promise libraries, performing the most basic tasks of creating a promise, adding a then handler and then resolving the promise.

Preparation HTML

<script src="https://rawgithub.com/petkaantonov/bluebird/master/js/browser/bluebird.js"></script>
<script>
  window.BluebirdPromise = window.Promise.noConflict();
  delete window.Promise;
</script>
<script src="https://rawgithub.com/kriskowal/q/v1/q.js"></script>
<script src="http://mstade.github.com/promise-jsperf/javascripts/jQuery.js"></script>
<script src="http://rsvpjs-builds.s3.amazonaws.com/rsvp-latest.js"></script>
<script src="http://mstade.github.com/promise-jsperf/javascripts/laissez-faire.js"></script>
<script src="http://mstade.github.com/promise-jsperf/javascripts/avow.js"></script>
<script>window.OldPromise = window.Promise;</script>
<script src="https://rawgithub.com/yahoo/ypromise/es6/promise.js"></script>
<script src="https://rawgithub.com/juandopazo/9772321/raw/c5c4f09adf847321e9582625909899fd175039e4/gistfile1.js"></script>
<script>window.PromisePolyfill = window.Promise; window.Promise = window.OldPromise; PromisePolyfill.async = asap;</script>

Test runner

Ready to run.

Testing in
TestOps/sec
q
// async test
var d = Q.defer()
d.promise.then(function done() {
  deferred.resolve()
})
d.resolve()
ready
jquery
// async test
var d = $.Deferred()
d.then(function done() {
  deferred.resolve()
})
d.resolve()
ready
RSVP
// async test
var resolve, p = new RSVP.Promise(function (r) {
  resolve = r;
});
p.then(function done() {
  deferred.resolve();
});
resolve();
ready
avow
// async test
var v = avow()
v.promise.then(function done() {
  deferred.resolve()
})
v.fulfill()
ready
bluebird
// async test
var resolve, p = new BluebirdPromise(function (r) {
  resolve = r;
});
p.then(function () {
  deferred.resolve();
});
resolve();
ready
ypromise
// async test
var resolve, p = new PromisePolyfill(function (r) {
  resolve = r;
});
p.then(function () {
  deferred.resolve();
});
resolve();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.