Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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:
one year ago
Benchmark engine:
Benchmark.js
Manual pick
50.0M/s
slice + reverse
13.4M/s
View exact numbers
Test name
Executions per second
✓
Manual pick
49,984,224 Ops/sec
slice + reverse
13,356,074 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()