Promise vs Callback (v24)

Revision 24 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Callback
// async test
var d = deferred;

function getData(callback) {

    callback('data')

}

getData(function(data) {
  d.resolve()
})
ready
Promise
// async test
var d = deferred;

function getData() {
  return new Promise(function(resolve) {

      resolve('data')

  })
}

getData().then(function(data) {
  d.resolve()
})
ready

Revisions

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