Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
.unshift() vs .push() + .reverse()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0
Browser:
Firefox 140
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 months ago
Benchmark engine:
Benchmark.js
.push() + reverse()
2.6M/s
.unshift()
262K/s
View exact numbers
Test name
Executions per second
✓
.push() + reverse()
2,553,510 Ops/sec
.unshift()
261,666 Ops/sec
Script Preparation code:
window.ELE_PER_CYCLE = 100;
Tests:
.unshift()
const reps = window.ELE_PER_CYCLE; const arr = []; for (let i = 0; i < reps; ++i) { arr.unshift(i); }
.push() + reverse()
const reps = window.ELE_PER_CYCLE; const arr = []; for (let i = 0; i < reps; ++i) { arr.push(i); } arr.reverse();