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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Splice
12183809.0 Ops/sec
Slice using spread uperator
7653666.0 Ops/sec
Slice using concat
4191809.2 Ops/sec
Filter
20918976.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)