Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Slice vs Index
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/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Array Index
187.1M/s
Array Slice
55.5M/s
View exact numbers
Test name
Executions per second
✓
Array Index
187,067,792 Ops/sec
Array Slice
55,455,240 Ops/sec
Tests:
Array Slice
const array = ['test','123','123','last']; const lastItem = array.slice(-1)[0];
Array Index
const array = ['test','123','123','last']; const lastItem = array[array.length - 1];