Script Preparation code:
AخA
 
var array = Array.from(Array(10000).keys())
Tests:
  • Object.fromEntries

     
    Object.fromEntries(array.map(value => [value, value]));
  • creating temporary objects

     
    const data = {};
    array.forEach(value => data[value] = value);
  • Array.reduce

     
    array.reduce((obj, item) => { obj[item] = item; return obj; }, {});
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object.fromEntries
    creating temporary objects
    Array.reduce

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Firefox 128 on Windows
View result in a separate tab
Test name Executions per second
Object.fromEntries 3818.7 Ops/sec
creating temporary objects 11886.4 Ops/sec
Array.reduce 12038.4 Ops/sec