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 (iPhone; CPU iPhone OS 16_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 16
Operating system:
iOS 16.1.1
Device Platform:
Mobile
Date tested:
2 years ago
Test name
Executions per second
array.slice()
5526786.0 Ops/sec
array.splice()
5331214.5 Ops/sec
array.shift()
11188797.0 Ops/sec
array.pop()
15632930.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()