Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
indexOf + toSpliced vs. filter
(version: 1)
Comparing performance of:
indexOf + splice vs filter
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = new Array(15000); arr.fill({ id: 0 }); arr = arr.map((el, idx) => el.id = idx); var idToFilter = Math.floor(Math.random() * 15000);
Tests:
indexOf + splice
var index = arr.indexOf(idToFilter); var newArray = arr.toSpliced(index, 1);
filter
var newArray = arr.filter(e => e.id !== idToFilter);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
indexOf + splice
filter
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Browser/OS:
Firefox 133 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
indexOf + splice
28558.8 Ops/sec
filter
10130.2 Ops/sec
Related benchmarks:
FindIndex + splice vs filter
FindIndex + splice vs filter FindIndex
FindIndex + splice vs filter + includes
FindIndex + splice vs filter (small set)
FindIndex + splice vs filter (fixed, slice array before splicing)
FindIndex + splice vs filter(2)
FindIndex(real findIndex) + splice vs filter
Filter vs indexOf + spread+ splice
indexOf + splice vs. filter
Comments
Confirm delete:
Do you really want to delete benchmark?