Try/Catch Error Perf (v72)

Revision 72 of this benchmark created on


Setup

var undef;

Test runner

Ready to run.

Testing in
TestOps/sec
Try Catch
try {
  return undef.prop;
} catch (ex) {
  return null;
}
ready
If Check
if (undef !== undefined) {
  return undef.prop;
} else {
  return null;
}
ready
Logic Testing
return (undef && undef.prop) || null;
ready
Conditional Operator
return undef ? undef.prop : null;
ready
in
if ("prop" in undef)
  return undef.prop;
else
  return null;
ready

Revisions

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