concat vs spread

Benchmark created on


Setup

const nums = [];
    for (let i = 0; i < 1000; i++) {
        nums.push({a:Math.random()*i});
    }

const nums2 = [];
    for (let i = 0; i < 1000; i++) {
        nums.push({a:Math.random()*i});
}

Test runner

Ready to run.

Testing in
TestOps/sec
concat
nums.concat(nums2);
ready
spread
[...nums, ...nums2];
ready

Revisions

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