Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
indexof vs equal with equals
compare single character
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
double
9.0M/s
triple
8.9M/s
indexof
8.6M/s
triple self
7.0M/s
View exact numbers
Test name
Executions per second
✓
double
8,981,151 Ops/sec
triple
8,948,769 Ops/sec
indexof
8,624,208 Ops/sec
triple self
6,951,356 Ops/sec
Script Preparation code:
var COUNT = 0; var character = 'a';
Tests:
indexof
if(character.indexOf('a') >= 0){COUNT++}
triple
if(character === "a"){COUNT++}
double
if(character == "a"){COUNT++}
triple self
if(character === character ){COUNT++}