Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
length -1 vs last vs at -1
(version: 1)
Comparing performance of:
length -1 vs last vs at -1
Created:
10 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var array = ['banana', 'sausage', 'jesus', 'sausage', 'jesus', 'sausage', 'jesus', 'sausage', 'jesus', 'sausage', 'jesus', 'sausage', 'jesus']
Tests:
length -1
array[array.length -1]
last
_.last(array)
at -1
array.at(-1)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
length -1
last
at -1
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
length -1
148979936.0 Ops/sec
last
143791904.0 Ops/sec
at -1
153958016.0 Ops/sec
Related benchmarks:
IndexOf vs Includes vs lodash includes
IndexOf vs Includes vs lodash includes vs lodash indexOf
length -1 vs last
indexOf vs _.indexOf
array IndexOf vs array Includes vs lodash indexOf
Lodash _.first vs array[0]
array indexOf vs if/or
lodash includes vs has
Comparing lodash's times with Array.from
Comments
Confirm delete:
Do you really want to delete benchmark?