Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Regex vs split / join
(version: 1)
Comparing performance of:
Regex vs split | join
Created:
15 days ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const genres = 'adventure, action, drama, entertainment, live, sports';
Tests:
Regex
const match = genres.match(/^[^,]*,[^,]*,[^,]*,/); const index = match ? match[0].length - 1 : -1; genres.substring(0, index).replaceAll(', ', ' \u2022 ');
split | join
genres.split(',').map((genre) => genre.trim()).filter(Boolean).slice(0, 3).join(' \u2022 ');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Regex
split | join
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
15 days ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.5 Safari/605.1.15
Browser/OS:
Safari 26 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Regex
11608416.0 Ops/sec
split | join
7061745.0 Ops/sec
Related benchmarks:
Split vs Match
r v s bench
r v s bench2
r v s bench3
Regex vs split/join vs substring
Regex v split find str
Regex vs String.includes in Array.filter v2
Regexp test VS array.every and includes
includes vs indexOf vs findIndex vs Regex
Comments
Confirm delete:
Do you really want to delete benchmark?