Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Slice + reverse vs manual picking array indexes
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Windows
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
Manual pick
49984224.0 Ops/sec
slice + reverse
13356074.0 Ops/sec
Script Preparation code:
var input = [1,2,3,4,5,6,7,8,9,10,11,12,13]; var inputLength = input.length;
Tests:
Manual pick
const result = [ input[inputLength - 1], input[inputLength - 2], input[inputLength - 3], input[inputLength - 4], input[inputLength - 5], input[inputLength - 6], input[inputLength - 7]]
slice + reverse
input.slice(inputLength-7, inputLength).reverse()