Script Preparation code:
Tests:
  • Double negation (!!row.length) with destructuring

  • Double negation (!!row.length) without destructuring

  • Comparison (row.length > 0) with destructuring

  • Comparison (row.length > 0) without destructuring

  • Double negation (!!row)

  • Boolean constructor

  • Array.length property

  • Array.some() method

  • Object.keys()

  • for...of loop

  • Array.isArray() with length

  • typeof with length

  • First element check

  • Length property cast with destructuring

  • Length property cast without destructuring

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Double negation (!!row.length) with destructuring
    Double negation (!!row.length) without destructuring
    Comparison (row.length > 0) with destructuring
    Comparison (row.length > 0) without destructuring
    Double negation (!!row)
    Boolean constructor
    Array.length property
    Array.some() method
    Object.keys()
    for...of loop
    Array.isArray() with length
    typeof with length
    First element check
    Length property cast with destructuring
    Length property cast without destructuring

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 10 days 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
Double negation (!!row.length) with destructuring 154255.5 Ops/sec
Double negation (!!row.length) without destructuring 152010.6 Ops/sec
Comparison (row.length > 0) with destructuring 152592.7 Ops/sec
Comparison (row.length > 0) without destructuring 154273.4 Ops/sec
Double negation (!!row) 117825.5 Ops/sec
Boolean constructor 128206.0 Ops/sec
Array.length property 153667.7 Ops/sec
Array.some() method 152293.2 Ops/sec
Object.keys() 693.9 Ops/sec
for...of loop 151516.3 Ops/sec
Array.isArray() with length 150011.1 Ops/sec
typeof with length 145366.7 Ops/sec
First element check 150875.2 Ops/sec
Length property cast with destructuring 155992.4 Ops/sec
Length property cast without destructuring 155272.9 Ops/sec