Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:94.0) Gecko/20100101 Firefox/94.0
Firefox 94
Mac OS X 10.15
Desktop
3 years ago
Test name Executions per second
Using Fill API 156745.2 Ops/sec
Using iteration 154040.4 Ops/sec
Script Preparation code:
AخA
 
var testArray = new Uint32Array(1024);
testArray.fill(2,0,1024);
Tests:
  • Using Fill API

     
    var testArray = new Uint32Array(1024);
    testArray.fill(2,0,1024);
  • Using iteration

     
    var testArray = new Uint32Array(1024);
    for(var i= 0; i < testArray.length; i++) {
      testArray[i] = 2;
    }