Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.push + Array.reverse vs Array.unshift
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/118.0.0.0 Safari/537.36
Browser:
Chrome 118
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Array.push + Array.reverse
23K/s
Array.unshift
234/s
View exact numbers
Test name
Executions per second
✓
Array.push + Array.reverse
23,103 Ops/sec
Array.unshift
234 Ops/sec
Script Preparation code:
const array = Array.from({length: 10_000}, () => Math.floor(Math.random() * 10_000_000))
Tests:
Array.push + Array.reverse
const temp = []; array.forEach(x => temp.push(x)); return temp.reverse();
Array.unshift
const temp = []; array.forEach(x => temp.unshift(x)); return temp;