Script Preparation code:
x
 
function multiArgs(a, b, c, d, e, f, g, h) {
    return a + b + c + d + e + f + g + h
}
function multiArgs2(...args) {
    return args.reduce((acc, val) => acc += val, 0)
}
function singleArg(obj) {
    return obj.a + obj.b + obj.c + obj.d + obj.e + obj.f + obj.g + obj.h
}
function singleArg2(obj) {
    return Object.values(obj).reduce((acc, val) => acc += val, 0)
}
Tests:
  • Multi args (1)

     
    for (let i = 0; i < 10000; ++i) {
        multiArgs(1, 2, 3, 4, 5, 6, 7, 8)
    }
  • Multi args (2)

     
    for (let i = 0; i < 10000; ++i) {
        multiArgs2(1, 2, 3, 4, 5, 6, 7, 8)
    }
  • Single arg (1)

     
    for (let i = 0; i < 10000; ++i) {
        singleArg({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8 })
    }
  • Single arg (2)

     
    for (let i = 0; i < 10000; ++i) {
        singleArg2({ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8 })
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Multi args (1)
    Multi args (2)
    Single arg (1)
    Single arg (2)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
Firefox 100 on Windows
View result in a separate tab
Test name Executions per second
Multi args (1) 98982.9 Ops/sec
Multi args (2) 2594.4 Ops/sec
Single arg (1) 132811.3 Ops/sec
Single arg (2) 621.8 Ops/sec