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
constructor comparison (null)
281.6M/s
instanceof Promise (null)
273.5M/s
then check (null)
273.0M/s
type obj?.then === function (null)
272.3M/s
then in (null)
271.0M/s
instanceof Promise (promise)
268.0M/s
type obj?.then === function (promise)
267.6M/s
then check (promise)
266.3M/s
then in (promise)
263.9M/s
then check (empty object)
258.1M/s
constructor comparison (promise)
256.3M/s
then in (empty object)
255.9M/s
type obj?.then === function (empty object)
251.3M/s
constructor comparison (empty object)
242.8M/s
instanceof Promise (empty object)
181.4M/s
View exact numbers
Test name Executions per second
constructor comparison (null) 281,647,872 Ops/sec
instanceof Promise (null) 273,454,208 Ops/sec
then check (null) 272,975,840 Ops/sec
type obj?.then === function (null) 272,279,488 Ops/sec
then in (null) 270,995,040 Ops/sec
instanceof Promise (promise) 267,995,344 Ops/sec
type obj?.then === function (promise) 267,618,192 Ops/sec
then check (promise) 266,313,056 Ops/sec
then in (promise) 263,913,248 Ops/sec
then check (empty object) 258,130,784 Ops/sec
constructor comparison (promise) 256,261,824 Ops/sec
then in (empty object) 255,866,288 Ops/sec
type obj?.then === function (empty object) 251,273,952 Ops/sec
constructor comparison (empty object) 242,777,056 Ops/sec
instanceof Promise (empty object) 181,374,336 Ops/sec
Script Preparation code:
Tests: