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
Go 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
split
1040.7M/s
rgx
1040.4M/s
View exact numbers
Test name
Executions per second
✓
split
1,040,723,328 Ops/sec
rgx
1,040,407,552 Ops/sec
Related benchmarks
String split using regex vs string v3
String split separator vs regex
Comments
Confirm delete:
Do you really want to delete benchmark?