filter + map vs reduce (v3)

Revision 3 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
filter + map
[1,2,3,4]
	.filter((i) => i % 2 === 0)
	.map((i) => i * 2);
ready
reduce
[1,2,3,4]
	.reduce((acc, i) => {
		if (i % 2 === 0) acc.push(i * 2);
		return acc;
	}, []);
ready

Revisions

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