spread vs Array.from from Set

Benchmark created on


Setup

let aArray = Array(30000).fill('aArray');
let bArray = Array(50000).fill('bArray');

Teardown

aArray = null;
bArray = null;

Test runner

Ready to run.

Testing in
TestOps/sec
spread
const cArray = [...new Set([...aArray, bArray])];

console.log(cArray);
ready
Array.from
const cArray = Array.from(new Set([...aArray, bArray]));

console.log(cArray);
ready

Revisions

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