Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Test with/without regex FINAL
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/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
with regex
2129084.0 Ops/sec
with split
2433694.5 Ops/sec
without both
31541658.0 Ops/sec
Tests:
with regex
function getDisplayName(definitionName) { const bundleId = getBundleId(definitionName); return name.substring(name.lastIndexOf(':') + 1); } function getBundleId(definitionName) { const matches = definitionName.match(/(.+):/); return (matches && matches.pop()) || ''; } const res = getDisplayName('foo:bar');
with split
function getDisplayName(definitionName) { const bundleId = getBundleId(definitionName); return name.substring(name.lastIndexOf(':') + 1); } function getBundleId(definitionName) { const matches = definitionName.split(':'); return matches[0]|| ''; } const res = getDisplayName('foo:bar');
without both
function getDisplayName(definitionName) { return definitionName.substring(definitionName.lastIndexOf(':') + 1); } const res = getDisplayName('foo:bar');