nodeType vs instanceof vs nodeType literalFastest: nodeType literal (1.4x faster)
5,614,644 ops/sec
4,561,516 ops/sec
3,965,375 ops/sec
Fastest: nodeType (1.4x faster)
38,493,148 ops/sec
37,933,132 ops/sec
26,783,040 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| nodeType | |
| instanceof | |
| nodeType literal |
| Test name | Executions per second |
|---|---|
| ✓ nodeType literal | 53,234,760 Ops/sec |
| nodeType | 52,586,720 Ops/sec |
| instanceof | 33,341,248 Ops/sec |