push-vs-spread

Benchmark created on


Setup

let array = [];

Test runner

Ready to run.

Testing in
TestOps/sec
push
for (let i = 0; i < 1000; i++) {
	array.push(i);
}
ready
spread
for (let i = 0; i < 1000; i++) {
	array = [...array, i];
}
ready

Revisions

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