Try/Catch performance overhead (v30)

Revision 30 of this benchmark created on


Description

Using try/catch inside of functions that allocate lots of variables introduces significant overhead. See this discussion related to node.js https://groups.google.com/forum/#!topic/nodejs-dev/E-Re9KDDo5w

Interestingly, other js engines don't have this overhead. All test runs have pretty uniform performance. But they are also significantly slower than the v8 control case.

Preparation HTML

<script>
  var instrument = "smtg";
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
control - no try/catch
if (instrument.prop && instrument.prop.prop2) {
  console.log(instrument.prop);
}
ready
try/catch
try {
  console.log(instrument.prop.prop2);
} catch (ex) {

}
ready

Revisions

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