Concat filter vs Reduce (v2)

Revision 2 of this benchmark created on


Setup

const array = Array.from(Array(1000).keys())
const id = Math.floor(Math.random() * array.length)

Test runner

Ready to run.

Testing in
TestOps/sec
Filter concat
[id].concat(array.filter(i => i != id))
ready
Reduce
array.reduce((a, i) => {if (i != id) a.push(i); return a}, [id])
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.