Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
slice vs splice vs shift vs delete
which is faster
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
splice
195.1M/s
slice
190.0M/s
shift
189.6M/s
delete
187.2M/s
View exact numbers
Test name
Executions per second
✓
splice
195,117,376 Ops/sec
slice
189,962,880 Ops/sec
shift
189,570,016 Ops/sec
delete
187,222,640 Ops/sec
Script Preparation code:
var list = new Array(10*1000); for (var i = 0; i < 10 * 1000; i++) { list[i]= i * Math.random(); }
Tests:
slice
while(list.length) { list = list.slice(1) }
shift
while(list.length) { list.shift() }
splice
while(list.length) { list.splice(0,1) }
delete
let i = 0 let ln= list.length while (i < ln) { list[i]; delete list[i]; i++ }