Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
return vs throw-catch
(version: 1)
Comparing performance of:
return vs throw catch
Created:
23 days ago
by:
Registered User
Jump to the latest result
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); } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
return
throw catch
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
23 days ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser/OS:
Firefox 152 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
return
103125592.0 Ops/sec
throw catch
885887.8 Ops/sec
Related benchmarks:
Jump vs switch case
my test bench 1
type coercion, switch case vs bounce pattern vs ternary
no loop, switch case vs bounce pattern vs ternary
object literal vs switch case
Switch vs map test2
Jump table vs switch case
Switch vs If javascript tester
Switch vs map first value
Comments
Confirm delete:
Do you really want to delete benchmark?