Try catch vs Promise catch async

Benchmark created by Anonymous on


Preparation HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/bluebird/1.2.2/bluebird.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/q.js/1.0.1/q.min.js"></script>

Test runner

Ready to run.

Testing in
TestOps/sec
Native try catch
try {
  throw new Error();
} catch (e) {
}
ready
Bluebird try catch
// async test
new Promise(function(resolve, reject) {
  throw new Error();
}).caught(function(e) {
  deferred.resolve()
});
ready
Q try catch
// async test
Q.try(function() {
  throw new Error();
}).catch(function(e) {
  deferred.resolve()
});
ready

Revisions

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