Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
regex v split
(version: 0)
Comparing performance of:
split vs rgx
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var str = "tag:cool"
Tests:
split
function doSplit() { const parts = str.split(':') if (parts.length !== 2) { return null } return parts[0] }
rgx
const rgx = /(?<tag>[a-z]+):(.*)?/ function doRgx() { const res = str.match(rgx) if (!res) { return null } return res.groups?.tag ?? null }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
split
rgx
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser/OS:
Chrome 120 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
split
1040723328.0 Ops/sec
rgx
1040407552.0 Ops/sec
Related benchmarks:
String split vs Regex 02
split vs regex match
String split using regex vs string v3
Split vs regexp
String split separator vs regex
Comments
Confirm delete:
Do you really want to delete benchmark?