HTML Preparation code:
AخA
 
1
<span></span>
Script Preparation code:
x
 
let span = document.body.querySelector("span");
class Float32ArrayExtended extends Float32Array {
  
  constructor (val) {
    super(1);
    this[0] = val;
  }
  get x () { return this[0]; }
  set x (v) { this[0] = v; }
}
class Int32ArrayExtended extends Int32Array {
  
  constructor (val) {
    super(1);
    this[0] = val;
  }
  get x () { return this[0]; }let
  set x (v) { this[0] = v; }
}
const size = 100000;
const array = new Array(16).fill(1);
const arrayEF32 = new Float32ArrayExtended (16);
const arrayF32 = new Float32Array (16);
const arrayEI32 = new Int32ArrayExtended (16);
const arrayI32 = new Int32Array (16);
let x = 1;
const obj = {
    get x() {
        return array[0];
    },
    set x(value) {
        array[0] = value;
    }
};
let sum = 0;
Tests:
  • array[0]

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        array[0] = Math.random () * 1000;
        sum += array[0];
    }
    span.innerText = sum;
  • set / get

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        obj.x = Math.random () * 1000;
        sum += obj.x;
    }
    span.innerText = sum;
  • float 32

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        arrayF32[0] = Math.random () * 1000;
        sum += arrayF32[0];
    }
    span.innerText = sum;
  • extended float 32

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        arrayEF32.x = Math.random () * 1000;
        sum += arrayEF32.x;
    }
    span.innerText = sum;
  • int 32

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        arrayI32[0] = Math.random () * 1000;
        sum += arrayI32[0];
    }
    span.innerText = sum;
  • extended int 32

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        arrayEI32.x = Math.random () * 1000;
        sum += arrayEI32.x;
    }
    span.innerText = sum;
  • simple

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        x = Math.random () * 1000;
        sum += x;
    }
    span.innerText = sum;
  • array[0] 2

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        array[0] = Math.random () * 1000;
        sum += array[0];
    }
    span.innerText = sum;
  • simple 2

     
    sum = 0;
    for (let i = 0; i < size; i++)
        sum += Math.random () * 1000;
    span.innerText = sum;
  • simple 3

     
    sum = 0;
    for (let i = 0; i < size; i++) {
        const x = Math.random () * 1000;
        sum += x;
    }
    span.innerText = sum;
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    array[0]
    set / get
    float 32
    extended float 32
    int 32
    extended int 32
    simple
    array[0] 2
    simple 2
    simple 3

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Chrome 133 on Linux
View result in a separate tab
Test name Executions per second
array[0] 68.9 Ops/sec
set / get 32.5 Ops/sec
float 32 63.0 Ops/sec
extended float 32 70.8 Ops/sec
int 32 72.5 Ops/sec
extended int 32 77.8 Ops/sec
simple 40.5 Ops/sec
array[0] 2 75.7 Ops/sec
simple 2 77.2 Ops/sec
simple 3 79.2 Ops/sec