Arrays of strings, concat vs push spread

Benchmark created on


Setup

const a2 = ['aaaaaaaaaaaaaaaa2', 'bbbbbbbbbbbbbbbb2', 'cccccccccccccccc2', 'dddddddddddddddd2', 'eeeeeeeeeeeeeeeeee2', 'ffffffffffffffffff2', 'ggggggggggggggggggggggggg2'];

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
let a1 = ['aaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbb', 'cccccccccccccccc', 'dddddddddddddddd', 'eeeeeeeeeeeeeeeeee', 'ffffffffffffffffff', 'ggggggggggggggggggggggggg'];

a1 = a1.concat(a2);
ready
Push spread
const a1 = ['aaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbb', 'cccccccccccccccc', 'dddddddddddddddd', 'eeeeeeeeeeeeeeeeee', 'ffffffffffffffffff', 'ggggggggggggggggggggggggg'];

a1.push(...a2);
ready

Revisions

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