Try/Catch Cost In a Loop (v12)

Revision 12 of this benchmark created by Yohan Siguret on


Setup

var obj = { a : 1, b : 2, c : 3, d : 4, e : 5 };

Test runner

Ready to run.

Testing in
TestOps/sec
Iteration with internal try/catch
var blah = '';
for (var prop in obj) {
  try {
    blah += obj[prop];
  } catch (e) {
    console.log(' ');
  }
}
ready
Vanilla iteration
var blah = '';
for (var prop in obj) {
  blah += obj[prop];
}
ready

Revisions

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