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 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0
Browser:
Firefox 133
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Splice
10488532.0 Ops/sec
Slice using spread uperator
6659020.0 Ops/sec
Slice using concat
8467531.0 Ops/sec
Filter
15166538.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)