Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Chrome 136
Mac OS X 10.15.7
Desktop
one year ago
Test name Executions per second
instanceof Promise (promise) 281194112.0 Ops/sec
instanceof Promise (empty object) 223709696.0 Ops/sec
instanceof Promise (null) 270780128.0 Ops/sec
then check (promise) 286208736.0 Ops/sec
then check (empty object) 239902096.0 Ops/sec
then check (null) 287877824.0 Ops/sec
constructor comparison (promise) 277557440.0 Ops/sec
constructor comparison (empty object) 255511536.0 Ops/sec
constructor comparison (null) 268254448.0 Ops/sec
type obj?.then === function (promise) 270145664.0 Ops/sec
type obj?.then === function (empty object) 259766656.0 Ops/sec
type obj?.then === function (null) 270843008.0 Ops/sec
Script Preparation code:
Tests:
  • instanceof Promise (promise)

  • instanceof Promise (empty object)

  • instanceof Promise (null)

  • then check (promise)

  • then check (empty object)

  • then check (null)

  • constructor comparison (promise)

  • constructor comparison (empty object)

  • constructor comparison (null)

  • type obj?.then === function (promise)

  • type obj?.then === function (empty object)

  • type obj?.then === function (null)

  • then in (promise)

  • then in (empty object)

  • then in (null)

  • instanceof Promise (undefined)

  • then check (undefined)

  • constructor comparison (undefined)

  • type obj?.then === function (undefined)

  • then in (undefined)