The method getElementById() vs The method querySelector()Fastest: The method getElementById() (5.1x faster)
16,357,200 ops/sec
3,217,793 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| The method getElementById() | |
| The method querySelector() |
| Test name | Executions per second |
|---|---|
| ✓ The method getElementById() | 51,472,640 Ops/sec |
| The method querySelector() | 8,065,096 Ops/sec |