Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
A Spl vs Regx
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Split
7941237.0 Ops/sec
Regex
8127405.0 Ops/sec
Script Preparation code:
const urlPath = "/aaa/bbbb/ccccc/dddddd/eeeeeee" function regspl() { if (urlPath === "/") { return [""]; } else { const regex = /[^\/]+/g; return urlPath.match(regex) || [""]; } } function nmsplit() { return urlPath.split('/').filter(Boolean); }
Tests:
Split
nmsplit()
Regex
regspl()