Test name | Executions per second |
---|---|
regex | 3767003.0 Ops/sec |
substring | 66508700.0 Ops/sec |
const link = "https://stats.nba.com";
const linkRegex = new RegExp(/^(http|www)/i);
const link = "https://stats.nba.com";
const linkRegex = new RegExp(/^(http|www)/i);
if(link.match(linkRegex) !== null){}
const link = "https://stats.nba.com";
const start = link.substring(0,3);
if(start === 'htt' || start === 'www'){}