Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
if else vs return
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 120
Operating system:
Android
Device Platform:
Mobile
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
if else
4.0M/s
return
4.0M/s
View exact numbers
Test name
Executions per second
✓
if else
3,999,848 Ops/sec
return
3,999,541 Ops/sec
Script Preparation code:
function sayHello1(name) { if(name.length > 10) { return "Wow ${name}, you have a very long name." } else { return "Hello, ${name}!" } } function sayHello2(name) { if(name.length <= 10) return "Hello, ${name}!" return "Wow ${name}, you have a very long name." }
Tests:
if else
sayHello1('janry')
return
sayHello2('janry')