Tests:
  • Spread

    x
     
    const data = [
        ["test1", 1],
        ["test2", 2],
        ["test3", 3],
        ["test4", 4],
        ["test5", 5],
        ["test6", 6],
        ["test7", 7],
        ["test8", 8],
        ["test9", 9],
    ]
    const res = data.reduce((acc, item) => ({...acc, [item[0]]: item[1]}), {})
  • Object assign

     
    const data = [
        ["test1", 1],
        ["test2", 2],
        ["test3", 3],
        ["test4", 4],
        ["test5", 5],
        ["test6", 6],
        ["test7", 7],
        ["test8", 8],
        ["test9", 9],
    ]
    const res = data.reduce((acc, item) => {Object.assign(acc, {[item[0]]: item[1]}); return acc;}, {})
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Spread
    Object assign

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Firefox 68 on Linux
View result in a separate tab
Test name Executions per second
Spread 108207.1 Ops/sec
Object assign 150927.7 Ops/sec