Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Try/catch performance for control flow #4
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Without try/catch
31K/s
Try/catch
12K/s
View exact numbers
Test name
Executions per second
✓
Without try/catch
30,820 Ops/sec
Try/catch
12,187 Ops/sec
HTML Preparation code:
<div id="test"></div>
Tests:
Try/catch
function checkNotFifty(num) { if (num !== 99999) { return true; } throw new Error('Number is odd'); } for (let i = 0; i < 100000;++i) { let res; try { checkNotFifty(i); res = true; } catch (err) { res = false; } }
Without try/catch
function checkNotFifty(num) { if (num !== 50) { return true; } return false; } for (let i = 0; i < 100000;++i) { let res; if (checkNotFifty(i)) { res = true; } else { res = false; } }