Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Remove array element by index
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:134.0) Gecko/20100101 Firefox/134.0
Browser:
Firefox 134
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
lodash pullAt
3097462.5 Ops/sec
filterByIndex
151548.5 Ops/sec
removeByIndex (concat)
314766.7 Ops/sec
removeByIndex2
160800.2 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
Script Preparation code:
const filterByIndex = (arr, index) => arr.filter((_, i) => i !== index); const removeByIndex = (arr, index) => arr.slice(0, index).concat(arr.slice(index + 1)); const removeByIndex2 = (arr, index) => [...arr.slice(0, index), ...arr.slice(index + 1)]; const arr = Array.from({ length: 1000 }, (_, i) => i); const index = 500;
Tests:
lodash pullAt
_.pullAt(arr, index);
filterByIndex
filterByIndex(arr, index);
removeByIndex (concat)
removeByIndex(arr, index);
removeByIndex2
removeByIndex2(arr, index);