promise comparisons (v6)

Revision 6 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="http://mstade.github.com/promise-jsperf/javascripts/q.js"></script>
<script src="http://mstade.github.com/promise-jsperf/javascripts/jQuery.js"></script>
<script src="https://raw.github.com/cujojs/when/dev-200/when.js"></script>
<script src="http://mstade.github.com/promise-jsperf/javascripts/rsvp.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>

Test runner

Ready to run.

Testing in
TestOps/sec
when
// async test
var d = when.defer()
d.promise.then(function done() {
  deferred.resolve()
})
d.resolve()
ready
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 p = new RSVP.Promise
p.then(function done() {
  deferred.resolve()
})
p.resolve()
ready
Laissez-faire
// async test
var p = new Promise
p.then(function done() {
  deferred.resolve()
})
p.resolve()
ready
avow
// async test
var v = avow()
v.promise.then(function done() {
  deferred.resolve()
})
v.fulfill()
ready

Revisions

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