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
Go 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:
4 months 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
filter It
4.3M/s
Splice It
1.1M/s
View exact numbers
Test name
Executions per second
✓
filter It
4,308,468 Ops/sec
Splice It
1,128,794 Ops/sec
Related benchmarks
Remove array element, findIndex and splice vs filter
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?