Script Preparation code:
x
 
const smallN = 2 ** 10
const bigN = 2 ** 20
const arr1 = []
const arr2 = []
for (let i = 0; i < bigN; ++i) {
    arr1.push(Math.random())
    arr2.push(Math.random())
}
Tests:
  • single loop (big N)

     
    for (let i = 0; i < bigN; ++i) {
        arr1[i] *= 2
        arr2[i] *= 2
    }
  • separate loops (big N)

     
    for (let i = 0; i < bigN; ++i) arr1[i] *= 2
    for (let i = 0; i < bigN; ++i) arr2[i] *= 2
  • single loop (small N)

     
    for (let i = 0; i < smallN; ++i) {
        arr1[i] *= 2
        arr2[i] *= 2
    }
  • separate loops (small N)

     
    for (let i = 0; i < smallN; ++i) arr1[i] *= 2
    for (let i = 0; i < smallN; ++i) arr2[i] *= 2
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    single loop (big N)
    separate loops (big N)
    single loop (small N)
    separate loops (small N)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131 on Windows
View result in a separate tab
Test name Executions per second
single loop (big N) 322.2 Ops/sec
separate loops (big N) 280.3 Ops/sec
single loop (small N) 345163.3 Ops/sec
separate loops (small N) 260841.3 Ops/sec