push vs set item index

Benchmark created on


Setup

const a = [];

Test runner

Ready to run.

Testing in
TestOps/sec
push
for(let x = 0; x < 1000; x++) {
	a.push(Math.random());
}
ready
set index
for(let x = 0; x < 1000; x++) {
	a[x] = Math.random();
}
ready

Revisions

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