Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
at(-1) vs slice(-1)[0] vs length - 1
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/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
length - 1
113.6M/s
at(-1)
97.3M/s
slice(-1)[0]
39.2M/s
View exact numbers
Test name
Executions per second
✓
length - 1
113,645,376 Ops/sec
at(-1)
97,301,496 Ops/sec
slice(-1)[0]
39,207,348 Ops/sec
Script Preparation code:
var array = Array({ length: 10000 }, (_, i) => i);
Tests:
at(-1)
array.at(-1);
length - 1
array[array.length - 1]
slice(-1)[0]
array.slice(-1)[0]