Test name | Executions per second |
---|---|
RegEx.test | 1984022.5 Ops/sec |
String.includes | 7989341.5 Ops/sec |
String.match | 1709255.2 Ops/sec |
== | 8037095.0 Ops/sec |
=== known length | 8017722.5 Ops/sec |
var string = "Hello world!";
var regex = /Hello/;
regex.test(string);
string.includes("Hello");
string.match("Hello");
"Hello" == string.slice(0, "Hello".length);
string.slice(0, 5) === "Hello"
string.startsWith("Hello")