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 (X11; Linux x86_64; rv:155.0) Gecko/20100101 Firefox/155.0
Browser:
Firefox 155
Operating system:
Linux
Device Platform:
Desktop
Date tested:
9 days ago
Benchmark engine:
Benchmark.js
.push() + reverse()
5.0M/s
.unshift()
396K/s
View exact numbers
Test name
Executions per second
✓
.push() + reverse()
4,953,966 Ops/sec
.unshift()
396,090 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();