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
23.2M/s
string .startsWith()
20.1M/s
regexp .test()
15.6M/s
string .match()
13.9M/s
View exact numbers
Test name Executions per second
indexOf === 0 23,226,528 Ops/sec
string .startsWith() 20,078,244 Ops/sec
regexp .test() 15,646,670 Ops/sec
string .match() 13,859,831 Ops/sec
Script Preparation code:
Tests: