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)

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    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)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
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 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
instanceof Promise (promise) 303837824.0 Ops/sec
instanceof Promise (empty object) 241658960.0 Ops/sec
instanceof Promise (null) 290129280.0 Ops/sec
then check (promise) 298302976.0 Ops/sec
then check (empty object) 254150944.0 Ops/sec
then check (null) 265423008.0 Ops/sec
constructor comparison (promise) 277396320.0 Ops/sec
constructor comparison (empty object) 260667152.0 Ops/sec
constructor comparison (null) 273117664.0 Ops/sec
type obj?.then === function (promise) 269327680.0 Ops/sec
type obj?.then === function (empty object) 257449760.0 Ops/sec
type obj?.then === function (null) 260597456.0 Ops/sec
then in (promise) 277073248.0 Ops/sec
then in (empty object) 262307344.0 Ops/sec
then in (null) 285495616.0 Ops/sec