Script Preparation code:
Tests:

Historical Performance Data aggregated from 9 community runs

Desktop Results:
Chrome 9 runs
instanceof Promise (null)
281.3M/s
instanceof Promise (promise)
279.1M/s
then in (promise)
277.0M/s
constructor comparison (promise)
274.7M/s
then check (promise)
272.0M/s
type obj?.then === function (null)
270.8M/s
type obj?.then === function (promise)
270.1M/s
constructor comparison (null)
270.0M/s
then in (null)
269.4M/s
then check (null)
268.4M/s
constructor comparison (empty object)
259.4M/s
type obj?.then === function (empty object)
257.4M/s
then in (empty object)
255.9M/s
then check (empty object)
255.5M/s
instanceof Promise (empty object)
223.7M/s

Fastest: instanceof Promise (null) (1.3x faster)

View exact numbers
  • instanceof Promise (null): 281,329,920 ops/sec
  • instanceof Promise (promise): 279,110,336 ops/sec
  • then in (promise): 277,024,768 ops/sec
  • constructor comparison (promise): 274,690,304 ops/sec
  • then check (promise): 272,032,704 ops/sec
  • type obj?.then === function (null): 270,843,008 ops/sec
  • type obj?.then === function (promise): 270,145,664 ops/sec
  • constructor comparison (null): 270,014,592 ops/sec
  • then in (null): 269,355,904 ops/sec
  • then check (null): 268,432,352 ops/sec
  • constructor comparison (empty object): 259,397,024 ops/sec
  • type obj?.then === function (empty object): 257,449,760 ops/sec
  • then in (empty object): 255,866,288 ops/sec
  • then check (empty object): 255,511,488 ops/sec
  • instanceof Promise (empty object): 223,709,696 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

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
instanceof Promise (promise)
303.8M/s
then check (promise)
298.3M/s
instanceof Promise (null)
290.1M/s
then in (null)
285.5M/s
constructor comparison (promise)
277.4M/s
then in (promise)
277.1M/s
constructor comparison (null)
273.1M/s
type obj?.then === function (promise)
269.3M/s
then check (null)
265.4M/s
then in (empty object)
262.3M/s
constructor comparison (empty object)
260.7M/s
type obj?.then === function (null)
260.6M/s
type obj?.then === function (empty object)
257.4M/s
then check (empty object)
254.2M/s
instanceof Promise (empty object)
241.7M/s
View exact numbers
Test name Executions per second
instanceof Promise (promise) 303,837,824 Ops/sec
then check (promise) 298,302,976 Ops/sec
instanceof Promise (null) 290,129,280 Ops/sec
then in (null) 285,495,616 Ops/sec
constructor comparison (promise) 277,396,320 Ops/sec
then in (promise) 277,073,248 Ops/sec
constructor comparison (null) 273,117,664 Ops/sec
type obj?.then === function (promise) 269,327,680 Ops/sec
then check (null) 265,423,008 Ops/sec
then in (empty object) 262,307,344 Ops/sec
constructor comparison (empty object) 260,667,152 Ops/sec
type obj?.then === function (null) 260,597,456 Ops/sec
type obj?.then === function (empty object) 257,449,760 Ops/sec
then check (empty object) 254,150,944 Ops/sec
instanceof Promise (empty object) 241,658,960 Ops/sec