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 (promise)
292.0M/s
instanceof Promise (promise)
291.3M/s
type obj?.then === function (promise)
286.8M/s
then check (null)
284.9M/s
instanceof Promise (null)
281.3M/s
then in (promise)
275.7M/s
then check (promise)
271.7M/s
then in (null)
264.3M/s
constructor comparison (null)
263.2M/s
constructor comparison (empty object)
255.8M/s
type obj?.then === function (null)
255.3M/s
then check (empty object)
253.9M/s
instanceof Promise (empty object)
252.4M/s
then in (empty object)
245.8M/s
type obj?.then === function (empty object)
244.2M/s
View exact numbers
Test name Executions per second
constructor comparison (promise) 291,952,128 Ops/sec
instanceof Promise (promise) 291,322,752 Ops/sec
type obj?.then === function (promise) 286,753,152 Ops/sec
then check (null) 284,931,488 Ops/sec
instanceof Promise (null) 281,329,920 Ops/sec
then in (promise) 275,684,640 Ops/sec
then check (promise) 271,678,016 Ops/sec
then in (null) 264,346,208 Ops/sec
constructor comparison (null) 263,155,680 Ops/sec
constructor comparison (empty object) 255,776,288 Ops/sec
type obj?.then === function (null) 255,328,784 Ops/sec
then check (empty object) 253,897,104 Ops/sec
instanceof Promise (empty object) 252,397,184 Ops/sec
then in (empty object) 245,837,536 Ops/sec
type obj?.then === function (empty object) 244,212,624 Ops/sec
Script Preparation code:
Tests: