new array vs spread operator

Benchmark created on


Setup

const initialArray = new Array(10000).fill("0");

Test runner

Ready to run.

Testing in
TestOps/sec
spread copy
const newArray = [...initialArray];
ready
new array copy
const newArray = new Array(initialArray);
ready

Revisions

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