Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Chrome 124
Windows
Desktop
2 years ago
Benchmark.js
indexOf === 0
23.7M/s
string .startsWith()
17.9M/s
regexp .test()
15.8M/s
string .match()
13.1M/s
View exact numbers
Test name Executions per second
indexOf === 0 23,738,706 Ops/sec
string .startsWith() 17,880,948 Ops/sec
regexp .test() 15,813,412 Ops/sec
string .match() 13,051,419 Ops/sec
Script Preparation code:
Tests: