array push vs array set (v2)

Revision 2 of this benchmark created on


Setup

const size = 100;
let result = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
push
const arr = [];
for(let i=0;i<size;i++){
	arr.push(i);
}
result = arr[size-1];
ready
set
const arr = new Array(size);
for(let i=0;i<size;i++){
	arr[i]=i;
}
result = arr[size-1];
ready

Revisions

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