Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109
Windows
Desktop
one year ago
Benchmark.js
indexOf === 0
654.8M/s
regexp .test()
31.6M/s
string .startsWith()
29.0M/s
string .match()
18.9M/s
View exact numbers
Test name Executions per second
indexOf === 0 654,781,120 Ops/sec
regexp .test() 31,604,796 Ops/sec
string .startsWith() 28,989,174 Ops/sec
string .match() 18,925,084 Ops/sec
Script Preparation code:
Tests: