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 | 4,348,108 Ops/sec |
| querySelector(ID) | 2,903,750 Ops/sec |
| exposed global object | 2,887,832 Ops/sec |
| exposed under the window object | 2,830,961 Ops/sec |
| querySelectorAll(ID) | 1,993,797 Ops/sec |