Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Chrome 127
Windows
Desktop
one year ago
Benchmark.js
indexOf === 0
161.1M/s
string .startsWith()
47.0M/s
regexp .test()
41.1M/s
string .match()
27.5M/s
View exact numbers
Test name Executions per second
indexOf === 0 161,094,848 Ops/sec
string .startsWith() 46,979,400 Ops/sec
regexp .test() 41,059,680 Ops/sec
string .match() 27,516,096 Ops/sec
Script Preparation code:
Tests: