Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
splice vs reassignment vs arr.length & push
Compares the speed of array reassignment methods on small arrays for known values
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Browser:
Chrome 143
Operating system:
Windows
Device Platform:
Desktop
Date tested:
3 months ago
Test name
Executions per second
array.splice()
13983629.0 Ops/sec
array.length & push
13117566.0 Ops/sec
reassignment
7643238.0 Ops/sec
Script Preparation code:
let array = [1, 2, 3, 4, 5, 6]
Tests:
array.splice()
array.splice(0, 6, 10, 20, 30, 40, 50, 60)
array.length & push
array.length = 0; array.push(10,20,30,40,50,60)
reassignment
array = [10,20,30,40,50,60]