Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134
Windows
Desktop
one year ago
Benchmark.js
indexOf === 0
118.1M/s
string .startsWith()
53.2M/s
regexp .test()
31.9M/s
string .match()
17.3M/s
View exact numbers
Test name Executions per second
indexOf === 0 118,050,040 Ops/sec
string .startsWith() 53,247,816 Ops/sec
regexp .test() 31,877,456 Ops/sec
string .match() 17,321,252 Ops/sec
Script Preparation code:
Tests: