Spread vs toArray

Benchmark created on


Setup

const arr = new Array(100000).fill(0).map((x, i) => [i, i]);
const map = new Map(arr);

Test runner

Ready to run.

Testing in
TestOps/sec
Spread
const values = [...map.values()];
ready
toArray
const values = map.values().toArray();
ready

Revisions

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