Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Splice vs Unshift (at least addition of last elements)
(version: 1)
Comparing performance of:
array.splice() vs array.shift()
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var array = [1, 2, 3, 4, 5, 6, 7, 8]
Tests:
array.splice()
array.splice(0, array.length-1, 77)
array.shift()
array.unshift(77)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
array.splice()
array.shift()
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0
Browser/OS:
Firefox 144 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
array.splice()
26783206.0 Ops/sec
array.shift()
670963.2 Ops/sec
Related benchmarks:
Slice vs splice
Slice vs splice forked
Slice vs splice first three elements
Slice vs splice 2 ...
splice vs shift 3
Splice vs shift to remove at beginning of array (fixed from slice)
Array splice vs delete
Splice vs Shift to remove from the beginning
Splice vs Shift perf
Empty array: Splice vs Shift
Comments
Confirm delete:
Do you really want to delete benchmark?