Script Preparation code:
x
 
var arr = [];
for (let i = 0; i < 100000; i++) arr.push(i);
Tests:
  • Map

     
    const array = arr.map(() => 0);
  • Fill

     
    const array = new Array(arr.length).fill(0);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Map
    Fill

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130 on Linux
View result in a separate tab
Test name Executions per second
Map 620.5 Ops/sec
Fill 3300.4 Ops/sec