Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
list push vs splice
(version: 6)
Comparing performance of:
append vs splice vs reverse vs concat vs unshift
Created:
5 years ago
by:
Registered User
Jump to the latest result
Script Preparation code:
l = 123;
Tests:
append
a = Array(l); a.push(3);
splice
a = Array(l); a.splice(0,0,3);
reverse
a = Array(l); a.reverse().push(3); a.reverse();
concat
a = Array(l); a = [3].concat(a);
unshift
a = Array(l); a.unshift(3);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
append
splice
reverse
concat
unshift
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
11 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
Browser/OS:
Firefox 139 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
append
9471739.0 Ops/sec
splice
6814630.5 Ops/sec
reverse
6011743.5 Ops/sec
concat
9425922.0 Ops/sec
unshift
7654639.5 Ops/sec
Related benchmarks:
Subarray - Splice vs Slice
slice VS splice: who is the fastest to keep constant size
list push vs splice into the end of array
slice VS splice VS shift: who is the fastest to keep constant size (fork no string push)
slice VS splice 1234567
Comments
Confirm delete:
Do you really want to delete benchmark?