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
91.0M/s
string .startsWith()
34.2M/s
regexp .test()
24.9M/s
string .match()
15.0M/s
View exact numbers
Test name Executions per second
indexOf === 0 91,015,912 Ops/sec
string .startsWith() 34,194,636 Ops/sec
regexp .test() 24,865,922 Ops/sec
string .match() 14,963,736 Ops/sec
Script Preparation code:
Tests: