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
21.6M/s
string .startsWith()
18.1M/s
regexp .test()
11.7M/s
string .match()
8.8M/s
View exact numbers
Test name Executions per second
indexOf === 0 21,553,892 Ops/sec
string .startsWith() 18,079,822 Ops/sec
regexp .test() 11,668,773 Ops/sec
string .match() 8,754,381 Ops/sec
Script Preparation code:
Tests: