Try/Catch Error Perf (v50)

Revision 50 of this benchmark created on


Preparation HTML

<script>
  function tryCatch(undef) {
    try {
      return undef.prop;
    } catch (ex) {
      return null;
    }
  }

  function ifCheck(undef) {
    if (undef !== undefined) {
      return undef.prop;
    } else {
      return null;
    }
  }

  function tryPerf(undef) {
    try {
      if (undef !== undefined) {
        return undef.prop;
      } else {
        return null;
      }
    } catch (ex) {
      return null;
    }
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Try Catch
tryCatch();
ready
If Check
ifCheck();
ready
Try performance
tryPerf();
ready

Revisions

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