Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
last item in array [length-1] vs slice(-1) vs pop
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
index[length - 1]
155631248.0 Ops/sec
Array.slice(-1)
56764428.0 Ops/sec
Script Preparation code:
const elements = document.all; window.arr = Array.from(elements);
Tests:
index[length - 1]
const arr = window.arr; const last = arr[arr.length-1];
Array.slice(-1)
const arr = window.arr; const last = arr.slice(-1)