Script Preparation code:
AخA
 
var data = { ...Array.from(Array(100).keys()) };
Tests:
  • Object.fromEntries

     
    Object.fromEntries(Object.entries(data).map((key, value) => [key, value]));
  • Reduce (reuse object)

     
    Object.entries(data).reduce((acc, [k, v]) => {
      acc[k] = v.toString();
      return acc;
    }, {});
  • Reduce (creating temporary objects)

     
    Object.entries(data).reduce((acc, [k, v]) => ({
      ...acc,
      [k]: v.toString()
    }), {});
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object.fromEntries
    Reduce (reuse object)
    Reduce (creating temporary objects)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Object.fromEntries 52808.7 Ops/sec
Reduce (reuse object) 431260.7 Ops/sec
Reduce (creating temporary objects) 175417.5 Ops/sec