Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
regexp vs split 6
(version: 0)
Comparing performance of:
regexp vs split vs manual method
Created:
5 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var fullAppName = 'vendor.appname@10.9.8' function eatUntil(stopChar, str) { let result = '' for (let i = 0, len = str.length; i < len; i++) { if (str[i] === stopChar) break result += str[i] } return [result, str.slice(result.length + 1)] }
Tests:
regexp
const splitAppName = /[^@.]+/g const [vendor] = splitAppName.exec(fullAppName) || [null] const [name] = splitAppName.exec(fullAppName) || [null] const [major] = splitAppName.exec(fullAppName) || [null]
split
const [fullName, version] = fullAppName.split('@', 2) const [major] = version.split('.', 1) const [vendor, name] = fullName.split('.', 2)
manual method
const [appName, version] = eatUntil('@', fullAppName); const [vendor, name] = eatUntil('.', appName); const [major] = eatUntil('.', version);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
regexp
split
manual method
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Counting words space - match vs split
String split vs Regex 02
double split vs regex
Split vs regexp
Comments
Confirm delete:
Do you really want to delete benchmark?