Array concat vs push vs spread (v3)

Revision 3 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Concat
let a = [];
for (let i = 0; i<= 1_000; i++) {
	a.concat(i);
}
ready
Push
let a = [];
for (let i = 0; i<= 1_000; i++) {
	a.push(i);
}
ready
Spread
let a = [];
for (let i = 0; i<= 1_000; i++) {
	a = [...a, i];
}
ready

Revisions

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