Script Preparation code:
AخA
 
var arr1 = new Uint8Array(2500);
var arr2 = new Uint8ClampedArray(2500);
Tests:
  • Uint8Array

     
    for(let i = 0; i < 2500; i += 4) {
      let next = (i + 4) % 2500;
      arr1[i] = arr1[next];
      arr1[i+1] = arr1[next+1];
      arr1[i+2] = arr1[next+2];
      arr1[i+3] = arr1[next+3];
    }
     arr1[37] = arr1[732]
  • Uint8ClampedArray

     
    for(let i = 0; i < 2500; i += 4) {
      let next = (i + 4) % 2500;
      arr2[i] = arr2[next];
      arr2[i+1] = arr2[next+1];
      arr2[i+2] = arr2[next+2];
      arr2[i+3] = arr2[next+3];
    }
     arr2[37] = arr2[732]
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Uint8Array
    Uint8ClampedArray

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 10 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126 on Windows
View result in a separate tab
Test name Executions per second
Uint8Array 6825.6 Ops/sec
Uint8ClampedArray 6860.9 Ops/sec