Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36
Chrome 111
Windows
Desktop
2 years ago
Test name Executions per second
rest arguments 13217201.0 Ops/sec
array parameter 14199516.0 Ops/sec
Script Preparation code:
x
 
function restFn(...args) {
    return args.map((x)=>x)
}
function arrFn(args) {
    return args.map((x)=>x)
}
Tests:
  • rest arguments

     
    const els = restFn('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
  • array parameter

     
    const els = arrFn(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']);