Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
array[array.length - 1] vs array.at(-1) v2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0
Browser:
Firefox 148
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
array[array.length - 1] fn
3325.2M/s
array[array.length - 1]
3274.0M/s
array.at(-1) fn
2463.2M/s
array.at(-1)
2454.6M/s
View exact numbers
Test name
Executions per second
✓
array[array.length - 1] fn
3,325,238,784 Ops/sec
array[array.length - 1]
3,274,011,648 Ops/sec
array.at(-1) fn
2,463,201,792 Ops/sec
array.at(-1)
2,454,609,408 Ops/sec
Script Preparation code:
var array = [1, 2, 3]; function last1(array) { return array[array.length - 1] } function last2(array) { return array.at(-1) }
Tests:
array[array.length - 1]
var d = array[array.length - 1];
array.at(-1)
var z = array.at(-1);
array[array.length - 1] fn
var x = last1(array);
array.at(-1) fn
var y = last2(array);