Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Remove item from array by index
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Splice
8420471.0 Ops/sec
Slice using spread uperator
5871920.0 Ops/sec
Slice using concat
6633362.5 Ops/sec
Filter
14415385.0 Ops/sec
Tests:
Splice
const a = ["a", "b", "c", "d", "e"]; const indexToRemove = 2; const b = a.splice(indexToRemove, 1);
Slice using spread uperator
const a = ["a", "b", "c", "d", "e"]; const indexToRemove = 2; const b = [...a.slice(0, indexToRemove), ...a.slice(indexToRemove + 1)];
Slice using concat
const a = ["a", "b", "c", "d", "e"]; const indexToRemove = 2; const b = a.slice(0, indexToRemove).concat(a.slice(indexToRemove + 1));
Filter
const a = ["a", "b", "c", "d", "e"]; const indexToRemove = 2; const b = a.filter((_, i) => i !== indexToRemove)