Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
URL parsing and matching
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
regex
14499035.0 Ops/sec
new URL
2045049.1 Ops/sec
Script Preparation code:
var href = 'https://www.testsite.com/some-path/another-path/2019/images/image.png'; var ASSETS_REGEX = new RegExp( `^https://www.testsite.com(?<publicPath>/some-path/another-path/2019/)(?<assetPath>(?:fonts|images)/.+)`, );
Tests:
regex
const match = href.match(ASSETS_REGEX) if (match) { const { publicPath, assetPath } = match return }
new URL
const url = new URL(href) const pathName = url.pathname.replace("/some-path/another-path/2019/", "") return url.origin === "https://www.testsite.com" && (pathName.startsWith('fonts') || pathName.startsWith('images'))