Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131
Linux
Desktop
one year ago
string.indexOf() != -1
19.4M/s
string.indexOf()
19.2M/s
string.indexOf() !== -1
19.1M/s
text.includes()
19.1M/s
regex.test()
14.2M/s
string.match()
11.6M/s
View exact numbers
Test name Executions per second
string.indexOf() != -1 19,352,494 Ops/sec
string.indexOf() 19,245,490 Ops/sec
string.indexOf() !== -1 19,132,560 Ops/sec
text.includes() 19,119,282 Ops/sec
regex.test() 14,228,535 Ops/sec
string.match() 11,646,598 Ops/sec
Script Preparation code:
Tests: