Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Chrome 129
Windows
Desktop
one year ago
Benchmark.js
indexOf === 0
14.6M/s
string .startsWith()
11.9M/s
regexp .test()
9.5M/s
string .match()
7.5M/s
View exact numbers
Test name Executions per second
indexOf === 0 14,649,277 Ops/sec
string .startsWith() 11,897,281 Ops/sec
regexp .test() 9,522,018 Ops/sec
string .match() 7,548,582 Ops/sec
Script Preparation code:
Tests: