Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
array.index and Array.splice vs Array.filter
(version: 1)
Test a speed difference between these 2 approaches
Comparing performance of:
Splice It vs filter It
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const toRemove = 'asdfasfd'; const array = ["first","second","third","asdawd","cxzcas", toRemove, "ljjjln","dfh93fsad9","asdfeh5","dsag442","gdsgds","fdsfrhdgr"];
Tests:
Splice It
const id = array.indexOf(toRemove); array.splice(id, 1);
filter It
array.filter(e => e != toRemove);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Splice It
filter It
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:6.8) Goanna/20260301 PaleMoon/34.1.0
Browser/OS:
Pale Moon (Firefox Variant) 34 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Splice It
1128794.5 Ops/sec
filter It
4308468.0 Ops/sec
Related benchmarks:
Remove array element, findIndex and splice vs filter
splice vs filterssss
Array.filter vs. Array.indexOf + splice
Array.splice vs Array.filter
Array.splice with indexOf vs Array.filter
JS filter vs splice +indexOf
Array.toSpliced vs Array.filter
Array.splice vs Array.filter V223
splice or filter
Comments
Confirm delete:
Do you really want to delete benchmark?