Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130
Windows
Desktop
one year ago
Benchmark.js
indexOf === 0
19.4M/s
string .startsWith()
17.3M/s
regexp .test()
15.4M/s
string .match()
13.0M/s
View exact numbers
Test name Executions per second
indexOf === 0 19,433,902 Ops/sec
string .startsWith() 17,286,548 Ops/sec
regexp .test() 15,420,225 Ops/sec
string .match() 12,979,318 Ops/sec
Script Preparation code:
Tests: