Adding element to array

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Array with Spread
let res = [];
for (let i = 0; i < 10000; i++) {
	res = [...res, i];
}
ready
Array.concat
let res = [];
for (let i = 0; i < 10000; i++) {
	res = res.concat([i]);
}
ready
Array.push
const res = [];
for (let i = 0; i < 10000; i++) {
	res.push(i);
}
ready

Revisions

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