querySelector vs getElementByIdFastest: getElementById (2.2x faster)
33,883,568 ops/sec
15,312,658 ops/sec
Fastest: getElementById (1.9x faster)
11,301,222 ops/sec
5,958,773 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| querySelector | |
| getElementById |
| Test name | Executions per second |
|---|---|
| ✓ getElementById | 19,433,364 Ops/sec |
| querySelector | 12,453,493 Ops/sec |