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
82.4M/s
string .startsWith()
33.9M/s
regexp .test()
25.3M/s
string .match()
15.1M/s
View exact numbers
Test name Executions per second
indexOf === 0 82,418,848 Ops/sec
string .startsWith() 33,929,332 Ops/sec
regexp .test() 25,324,804 Ops/sec
string .match() 15,108,029 Ops/sec
Script Preparation code:
Tests: