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
then check (null)
287.9M/s
then check (promise)
286.2M/s
instanceof Promise (promise)
281.2M/s
constructor comparison (promise)
277.6M/s
type obj?.then === function (null)
270.8M/s
instanceof Promise (null)
270.8M/s
type obj?.then === function (promise)
270.1M/s
constructor comparison (null)
268.3M/s
type obj?.then === function (empty object)
259.8M/s
constructor comparison (empty object)
255.5M/s
then check (empty object)
239.9M/s
instanceof Promise (empty object)
223.7M/s
View exact numbers
Test name Executions per second
then check (null) 287,877,824 Ops/sec
then check (promise) 286,208,736 Ops/sec
instanceof Promise (promise) 281,194,112 Ops/sec
constructor comparison (promise) 277,557,440 Ops/sec
type obj?.then === function (null) 270,843,008 Ops/sec
instanceof Promise (null) 270,780,128 Ops/sec
type obj?.then === function (promise) 270,145,664 Ops/sec
constructor comparison (null) 268,254,448 Ops/sec
type obj?.then === function (empty object) 259,766,656 Ops/sec
constructor comparison (empty object) 255,511,536 Ops/sec
then check (empty object) 239,902,096 Ops/sec
instanceof Promise (empty object) 223,709,696 Ops/sec
Script Preparation code:
Tests: