Fastest way to merge two arrays (v3)

Revision 3 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Concat
let original = ['hello', 1, 2, 3, { randomThing: 'buh' }];

const args = [{ one: 'thing1', two: 'thing2' }];

original = original.concat(args);
ready
Spread
let original = ['hello', 1, 2, 3, { randomThing: 'buh' }];

const args = [{ one: 'thing1', two: 'thing2' }];

const newArr = [...original, ...args];
ready
Push
let original = ['hello', 1, 2, 3, { randomThing: 'buh' }];

const args = [{ one: 'thing1', two: 'thing2' }];

original.push.apply(original, args);
ready

Revisions

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