map-filter-or-reduce

Benchmark created on


Setup

window.arr = new Array(10000).map((_,i) => i)

Test runner

Ready to run.

Testing in
TestOps/sec
f-m
const newArr = window.arr.filter(x=>x%2).map(x=>2*x)
ready
r
const newArr = window.arr.reduce((acc, val) => {
	if(val%2) {
		return [acc, val*2]
	}
	return acc
},[])
ready

Revisions

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