Tests:
  • JS Array set

    x
     
    const jsArray = Array.from({ length: 1000 }, (_, i) => ({
      id: i,
      a: 1,
      b: 2,
      timeMs: 0,
    }));
    // * update jsArray timeMs with 1
    jsArray.forEach((item) => (item.timeMs = 1));
  • JS Array map

     
    const jsArray = Array.from({ length: 1000 }, (_, i) => ({
      id: i,
      a: 1,
      b: 2,
      timeMs: 0,
    }));
    // * update jsArray timeMs with jsArray.map
    const jsArrayMap = jsArray.map((item) => ({ ...item, timeMs: 1 }));
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    JS Array set
    JS Array map

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Chrome 119 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
JS Array set 32848.7 Ops/sec
JS Array map 23870.4 Ops/sec