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 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Splice
32941166.0 Ops/sec
Slice using spread uperator
19625256.0 Ops/sec
Slice using concat
10571830.0 Ops/sec
Filter
55650816.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)