Script Preparation code:
x
 
var count = 100;
var bigArr = new Float32Array(16 * count);
var bigArr2 = Array(16 * count);
var arrs = new Array(count);
for (let i = 0; i < count; i++) {
  var a = arrs[i] = new Float32Array(16);
  for (let x = 0; x < 16; x++) {
    var v = Math.random();
    a[x] = v;
    bigArr[i * 16 + x] = v;
    bigArr2[i * 16 + x] = v;
  }
}
var t;
Tests:
  • Big array read in chunks

     
    t = 0;
    let c = 16 * count;
    for (let i = 0; i < c; i += 16) {
      for (let x = 0; x < 16; x++) {
        t += bigArr[i + x];
      }
    }
  • Small array read

     
    t = 0;
    for (const a of arrs) {
      for (let x = 0; x < 16; x++) {
        t += a[x];
      }
    }
  • Big array read simple

     
    t = 0;
    let c = 16 * count;
    for (let i = 0; i < c; i++) {
      t += bigArr[i];
    }
  • non-typed big array read in chunks

     
    t = 0;
    let c = 16 * count;
    for (let i = 0; i < c; i += 16) {
      for (let x = 0; x < 16; x++) {
        t += bigArr2[i + x];
      }
    }
  • non-typed big array read simple

     
    t = 0;
    let c = 16 * count;
    for (let i = 0; i < c; i++) {
      t += bigArr2[i];
    }
  • Big array read realistic

     
    t = 0;
    let c = 16 * count;
    for (let i = 0; i < c; i += 16) {
      t += bigArr[i + 0];
      t += bigArr[i + 1];
      t += bigArr[i + 2];
      t += bigArr[i + 3];
      t += bigArr[i + 4];
      t += bigArr[i + 5];
      t += bigArr[i + 6];
      t += bigArr[i + 7];
      t += bigArr[i + 8];
      t += bigArr[i + 9];
      t += bigArr[i + 10];
      t += bigArr[i + 11];
      t += bigArr[i + 12];
      t += bigArr[i + 13];
      t += bigArr[i + 14];
      t += bigArr[i + 15];
    }
  • small array read realistic

     
    t = 0;
    for (const a of arrs) {
      t += a[0];
      t += a[1];
      t += a[2];
      t += a[3];
      t += a[4];
      t += a[5];
      t += a[6];
      t += a[7];
      t += a[8];
      t += a[9];
      t += a[10];
      t += a[11];
      t += a[12];
      t += a[13];
      t += a[14];
      t += a[15];
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Big array read in chunks
    Small array read
    Big array read simple
    non-typed big array read in chunks
    non-typed big array read simple
    Big array read realistic
    small array read realistic

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122 on Linux
View result in a separate tab
Test name Executions per second
Big array read in chunks 4791.9 Ops/sec
Small array read 6743.0 Ops/sec
Big array read simple 4888.4 Ops/sec
non-typed big array read in chunks 4941.8 Ops/sec
non-typed big array read simple 4914.7 Ops/sec
Big array read realistic 4887.6 Ops/sec
small array read realistic 6905.9 Ops/sec