Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 15_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Mobile/15E148 Safari/604.1
Mobile Safari 15
iOS 15.1.1
Mobile
3 years ago
Test name Executions per second
RegEx.test 1335680.4 Ops/sec
String.includes 4045273.5 Ops/sec
Script Preparation code:
AخA
 
var string = "Hello world123!";
var regex = /(abc|bcd|cde|def|efg|fgh|ghi|hij|ijk|jkl|klm|lmn|mno|nop|opq|pqr|qrs|rst|stu|tuv|uvw|vwx|wxy|xyz|012|123|234|345|456|567|678|789)+/i;
Tests:
  • RegEx.test

     
    regex.test(string);
  • String.includes

     
    string.includes("abc", "bcd", "cde", "def", "efg", "fgh", "ghi", "hij", "ijk", "jkl", "klm", "lmn", "mno", "nop", "opq", "pqr", "qrs", "rst", "stu", "tuv", "uvw", "vwx", "wxy", "xyz", "012", "123", "234", "345", "456", "567", "678", "789")