Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
regex vs substring compare
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 13; Mobile; rv:122.0) Gecko/122.0 Firefox/122.0
Browser:
Firefox Mobile 122
Operating system:
Android
Device Platform:
Mobile
Date tested:
2 years ago
Test name
Executions per second
regex
7177758.5 Ops/sec
substring
1152434560.0 Ops/sec
Script Preparation code:
const link = "https://stats.nba.com"; const linkRegex = new RegExp(/^(http|www)/i);
Tests:
regex
const link = "https://stats.nba.com"; const linkRegex = new RegExp(/^(http|www)/i); if(link.match(linkRegex) !== null){}
substring
const link = "https://stats.nba.com"; const start = link.substring(0,3); if(start === 'htt' || start === 'www'){}