Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Split vs push
(version: 1)
Comparing performance of:
String + split vs Array push
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const sampleData = new Array(10000).fill('a');
Tests:
String + split
const len = sampleData.length; let res = ''; for (let i = 0; i < len; ++i) { res += sampleData[i] + ' '; } res.split(' ');
Array push
const len = sampleData.length; let res = []; for (let i = 0; i < len; ++i) { res.push(sampleData[i]); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
String + split
Array push
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:135.0) Gecko/20100101 Firefox/135.0
Browser/OS:
Firefox 135 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
String + split
4048.4 Ops/sec
Array push
24059.2 Ops/sec
Related benchmarks:
assign comparison
Array Entries vs fori
Stor info in Array vs Object
This site broken
unshift vs push
for vs for ... of 2
TestArrayAllocationv2
3333test
12132132132131243214124
Comments
Confirm delete:
Do you really want to delete benchmark?