Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Safari 17
Mac OS X 10.15.7
Desktop
11 months ago
Test name Executions per second
explicit null check 8517670.0 Ops/sec
explicit null non-check 8507424.0 Ops/sec
explicit undefined check 8685057.0 Ops/sec
explicit undefined non-check 8519780.0 Ops/sec
implicit undefined check 8487093.0 Ops/sec
implicit undefined non-check 8399708.0 Ops/sec
Script Preparation code:
AخA
 
var one = { a: 123, b: null }
var two = { a: 123, b: undefined }
var three = {a: 123}
Tests:
  • explicit null check

     
    one.b == null
  • explicit null non-check

     
    one.b != null
  • explicit undefined check

     
    two.b == null
  • explicit undefined non-check

     
    two.b != null
  • implicit undefined check

     
    three.b == null
  • implicit undefined non-check

     
    three.b != null