Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
return vs throw-catch
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser:
Firefox 152
Operating system:
Windows
Device Platform:
Desktop
Date tested:
23 days ago
Test name
Executions per second
return
103125592.0 Ops/sec
throw catch
885887.8 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function rtrn(n) { switch (n) { case 0: return 'a'; case 1: return 'b'; case 2: return 'c'; default: return false; } } function thrw(n) { switch (n) { case 0: return 'a'; case 1: return 'b'; case 2: return 'c'; default: throw new Error(); } }
Tests:
return
let values = []; for (let i = 0; i < 4; ++i) { values.push(rtrn(i)); }
throw catch
let values = []; for (let i = 0; i < 4; ++i) { try { values.push(thrw(i)); }catch{ values.push(false); } }