Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
string comparison vs array includes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/126.1 Mobile/15E148 Safari/605.1.15
Browser:
Mobile Safari 17
Operating system:
iOS 17.4.1
Device Platform:
Mobile
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
string compare
12.0M/s
array includes
8.0M/s
View exact numbers
Test name
Executions per second
✓
string compare
11,976,617 Ops/sec
array includes
7,970,336 Ops/sec
Script Preparation code:
function stringCompare(x) { return x === '' || x === 'USA' || x === 'Canada' || x === 'Mexico' || x === 'UK' || x === 'Germany' || x === 'Sweden'; } function arrayIncludes(x) { return ['', 'USA', 'Canada', 'Mexico', 'UK', 'Germany', 'Sweden'].includes(x); }
Tests:
string compare
stringCompare('abc');
array includes
arrayIncludes('abc');