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
text.includes()
16.8M/s
string.indexOf() != -1
14.0M/s
string.indexOf() !== -1
13.1M/s
regex.test()
12.6M/s
string.indexOf()
12.6M/s
string.match()
10.7M/s
View exact numbers
Test name Executions per second
text.includes() 16,763,551 Ops/sec
string.indexOf() != -1 14,038,816 Ops/sec
string.indexOf() !== -1 13,087,480 Ops/sec
regex.test() 12,643,359 Ops/sec
string.indexOf() 12,637,869 Ops/sec
string.match() 10,746,550 Ops/sec
Script Preparation code:
Tests: