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
20.9M/s
string .startsWith()
17.0M/s
regexp .test()
12.4M/s
string .match()
8.7M/s
View exact numbers
Test name Executions per second
indexOf === 0 20,941,084 Ops/sec
string .startsWith() 17,021,636 Ops/sec
regexp .test() 12,380,015 Ops/sec
string .match() 8,680,285 Ops/sec
Script Preparation code:
Tests: