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
Test name
Executions per second
pop
15367090.0 Ops/sec
shift
15580063.0 Ops/sec
unshift
6.2 Ops/sec
push
2106.2 Ops/sec
index
6414.2 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; }