Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
pop() vs shift() vs unshift vs pop vs index
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
shift
15.6M/s
pop
15.4M/s
index
6K/s
push
2K/s
unshift
6/s
View exact numbers
Test name
Executions per second
✓
shift
15,580,063 Ops/sec
pop
15,367,090 Ops/sec
index
6,414 Ops/sec
push
2,106 Ops/sec
unshift
6 Ops/sec
Script Preparation code:
var array = new Array(100000); for(let i = 0; i < 100000; ++i) { array[i] = i; }
Tests:
pop
while (array.length > 0) { array.pop(); }
shift
while (array.length > 0) { array.shift(); }
unshift
let a = []; for(let i = 0; i < 100000; ++i) { a.unshift(i); }
push
let a = []; for(let i = 0; i < 100000; ++i) { a.push(i); }
index
let a = new Array(100000); for(let i = 0; i < 100000; ++i) { a[i] = i; }