Try/Catch Error Perf (v45)

Revision 45 of this benchmark created on


Setup

function tryCatchNoError(undef) {
        try {
          return (undef !== undefined) ? undef.prop : null;
        } catch (ex) {
          return null;
        }
      }
    
      function tryCatchWithError(undef) {
        try {
          return undef.prop;
        } catch (ex) {
          return null;
        }
      }
    
      function ifCheck(undef) {
        return (undef !== undefined) ? undef.prop : null;
      }

Test runner

Ready to run.

Testing in
TestOps/sec
Try Catch, no error
tryCatchNoError();
ready
Try Catch, error
tryCatchWithError()
ready
If Check
ifCheck();
ready

Revisions

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