Array.from second argument

Benchmark created on


Setup

const targetArray =
	(new Array(10000)).fill(null).map(
		(_, index) => [
			index.toString(),
			index,
		]
	);
const targetMap = new Map(targetArray);

Test runner

Ready to run.

Testing in
TestOps/sec
Array.from
const result = Array.from(
	targetMap,
	([id, item]) => ({id, item})
);

ready
Array.from -> Array.prototype.map
const result = Array.from(targetMap).map(
	([id, item]) => ({id, item})
);

ready

Revisions

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