Run details:
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
Windows
Desktop
4 months ago
Test name Executions per second
Double negation (!!row.length) with destructuring 152023.5 Ops/sec
Double negation (!!row.length) without destructuring 150900.1 Ops/sec
Comparison (row.length > 0) with destructuring 149770.0 Ops/sec
Comparison (row.length > 0) without destructuring 149477.1 Ops/sec
Double negation (!!row) 113755.1 Ops/sec
Boolean constructor 122064.4 Ops/sec
Array.length property 148235.5 Ops/sec
Array.some() method 149990.5 Ops/sec
Object.keys() 667.9 Ops/sec
for...of loop 147990.8 Ops/sec
Array.isArray() with length 147376.4 Ops/sec
typeof with length 142089.6 Ops/sec
First element check 149051.6 Ops/sec
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