Array.from vs Spread

Benchmark created on


Setup

const largeMap = new Map();
for (let i = 0; i < 100000; i++) {
  largeMap.set(i, { value: i });
}

Test runner

Ready to run.

Testing in
TestOps/sec
Array.from
const arrayFromValues = Array.from(largeMap.values());
ready
Spread
const spreadValues = [...largeMap.values()];
ready

Revisions

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