Array-like allocation (v2)

Revision 2 of this benchmark created on


Setup

const iterations = 100;
const SIZE = 70000;

Test runner

Ready to run.

Testing in
TestOps/sec
Array pre-alloc + fill
for (let i=0;i<iterations;i++) {
  const a = new Array(SIZE).fill(0);	
  for (let j=0;j<SIZE;j++) {
    a[j] = 1;
  }
}

ready
Array pre-alloc + nofill
for (let i=0;i<iterations;i++) {
  const a = new Array(SIZE);	
  for (let j=0;j<SIZE;j++) {
    a[j] = 1;
  }
}
ready
Array no alloc + no fill
for (let i=0;i<iterations;i++) {
  const a = new Array();	
  for (let j=0;j<SIZE;j++) {
    a[j] = 1;
  }
}
ready
Int32Array pre-alloc
for (let i=0;i<iterations;i++) {
  const a = new Int32Array(SIZE);	
  for (let j=0;j<SIZE;j++) {
    a[j] = 1;
  }
}
ready
Int64Array pre-alloc
for (let i=0;i<iterations;i++) {
  const a = new Int64Array(SIZE);	
  for (let j=0;j<SIZE;j++) {
    a[j] = 1;
  }
}
ready

Revisions

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