instanceof vs constructor.name vs fieldFastest: instanceof (2.8x faster)
159,417,280 ops/sec
158,618,256 ops/sec
57,824,172 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| instanceof | |
| constructor.name | |
| field |
| Test name | Executions per second |
|---|---|
| ✓ instanceof | 127,204,504 Ops/sec |
| field | 126,593,456 Ops/sec |
| constructor.name | 37,426,860 Ops/sec |