Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Slice vs Splice vs Shift vs pop
Compares the speed for removing 2 items from the beginning of an array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Mobile Safari/537.36 EdgA/135.0.0.0
Browser:
Chrome Mobile 135
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
array.slice()
2646963.2 Ops/sec
array.splice()
15421525.0 Ops/sec
array.shift()
31068284.0 Ops/sec
array.pop()
46512896.0 Ops/sec
Script Preparation code:
var array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, "asdas", "asdas", "asda", "asdas", "asd", "adas", "asefacw", "asdfacs"] var itemsToRemove = 1
Tests:
array.slice()
array = array.slice(1)
array.splice()
array.splice(0, itemsToRemove)
array.shift()
array.shift()
array.pop()
array.pop()