Test name | Executions per second |
---|---|
FindIndex + splice | 2350.0 Ops/sec |
filter | 22623616.0 Ops/sec |
var arr = new Array(15000);
arr.fill({ id: 0 });
arr = arr.map((el, idx) => el.id = idx);
var foo = Math.floor(Math.random() * 15000);
var index = arr.findIndex((el) => el === foo);
var newArr = arr.splice(index, 1);
var index = arr.filter(el => el !== foo)