Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
splice or filter
(version: 1)
Comparing performance of:
filter vs splice
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script> const array = ["first", "second", "third", "asdawd", "cxzcas", "ljjjln", "dfh93fsad9", "asdfeh5", "dsag442", "gdsgds", "fdsfrhdgr"]; </script>
Script Preparation code:
function spliceIt(array, elementIdx) { const newArr = [...array] newArr.splice(elementIdx, 1); return newArr; } function filterIt(array, elementIdx) { return array.filter((el, idx) => idx !== elementIdx); }
Tests:
filter
filterIt(array, 5);
splice
spliceIt(array, 5);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
filter
splice
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Browser/OS:
Chrome 139 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
filter
15939967.0 Ops/sec
splice
9229228.0 Ops/sec
Related benchmarks:
splice vs delete
Remove by splice vs spliceIdx vs filter
remove by splice vs filter array
remove by splice vs filter array v3
Array.splice vs Array.filter
Array.splice with indexOf vs Array.filter
Array.toSpliced vs Array.filter
Remove by splice vs filter with a known index
Array.splice vs Array.filter V223
Comments
Confirm delete:
Do you really want to delete benchmark?