Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.splice + indexOf vs Array.filter
Test a speed difference between these 2 approaches
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/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Splice It
25714312.0 Ops/sec
filter It
59279696.0 Ops/sec
HTML Preparation code:
<script> const i1 = {}; const i2 = {}; const i3 = {}; const i4 = {}; const i5 = {}; const i6 = {}; const i7 = {}; const i8 = {}; const i9 = {}; const i10 = {}; const array = [i1, i2, i3, i4, i5, i6, i7, i8, i9, i10]; </script>
Script Preparation code:
function spliceIt(array, element){ const index = array.indexOf(element); array.splice(index, 1); } function filterIt(array, element){ array = array.filter(el => el !== element); }
Tests:
Splice It
spliceIt(array, i5);
filter It
filterIt(array, i5);