Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Splice vs Spread vs Unshift to insert at beginning of 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/136.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 136
Operating system:
Android
Device Platform:
Mobile
Date tested:
10 months ago
Test name
Executions per second
Splice
52836836.0 Ops/sec
Spread
3554794.2 Ops/sec
Unshift
31253.0 Ops/sec
Script Preparation code:
var array = Array.from({ length: 100 }).map((val, i) => i);
Tests:
Splice
var newArray = array.slice(0, 0, 99);
Spread
var newArray = [99, ...array];
Unshift
var newArray = array.unshift(99);