Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
str.match vs str.Split crlf
(version: 0)
Test String.match with regex against String.split with string. We are splitting a string at the spaces.
Comparing performance of:
String.split vs Regex.match
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
string = "This is a benchmark to test if matching a regex is faster that splitting a string\nThis is a benchmark to test if matching a regex is faster that splitting a string\nThis is a benchmark to test if matching a regex is faster that splitting a string\nThis is a benchmark to test if matching a regex is faster that splitting a string\nThis is a benchmark to test if matching a regex is faster that splitting a string\n"; regex = /\S+/gi;
Tests:
String.split
string.split("/\r\n|\r|\n/")
Regex.match
string.match("/[^\r\n]+/g")
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
String.split
Regex.match
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!
Comments
Confirm delete:
Do you really want to delete benchmark?