Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
many if vs includes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Browser:
Chrome 117
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
many if
786800128.0 Ops/sec
includes
677927360.0 Ops/sec
Tests:
many if
const value = 4 if (value === 1) { return value } else if (value === 1) { return value } else if (value === 2) { return value } else if (value === 3) { return value } else if (value === 4) { return value }
includes
const options = [1, 2, 3, 4] const value = 4 if (options.includes(4)) { return value }