Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array Slice vs index
(version: 0)
Comparing performance of:
getIndexLast vs getSliceLast
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var x = [...Array(1000).keys()] function getIndexLast(a) { return a[a.length-1]} function getSliceLast(a) { return a.slice(-1)[0]}
Tests:
getIndexLast
getIndexLast(x)
getSliceLast
getSliceLast(x)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
getIndexLast
getSliceLast
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
`Array.slice(-1)[0]` vs `Array[Array.length]` for 10000 length
Slice vs splice first three elements
slice vs get by index
`array.slice(-1)[0]` vs `array[array.length - 1]`
Comments
Confirm delete:
Do you really want to delete benchmark?