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
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
Script Preparation code:
Tests: