getElementById vs querySelector(ID) vs querySelectorAll(ID) vs exposed global object vs exposed under the window object| Test case name | Result |
|---|---|
| getElementById | |
| querySelector(ID) | |
| querySelectorAll(ID) | |
| exposed global object | |
| exposed under the window object |
| Test name | Executions per second |
|---|---|
| ✓ getElementById | 5,162,162 Ops/sec |
| querySelector(ID) | 3,586,183 Ops/sec |
| exposed under the window object | 2,126,108 Ops/sec |
| querySelectorAll(ID) | 1,740,024 Ops/sec |
| exposed global object | 1,669,356 Ops/sec |