offsetWidth / offsetHeight (destructured and renamed) vs offsetWidth / offsetHeight (destructured) vs offsetWidth / offsetHeight (simple property access) vs getBoundingClientRect() (destructured) vs getBoundingClientRect() (simple property access)Fastest: getBoundingClientRect() (simple property access) (1.5x faster)
1,138,444 ops/sec
1,106,426 ops/sec
827,353 ops/sec
768,440 ops/sec
766,938 ops/sec
Fastest: offsetWidth / offsetHeight (simple property access) (2.2x faster)
6,430,355 ops/sec
6,425,653 ops/sec
6,420,216 ops/sec
2,965,858 ops/sec
2,946,736 ops/sec
Fastest: offsetWidth / offsetHeight (destructured) (2.2x faster)
7,104,510 ops/sec
6,973,682 ops/sec
6,043,932 ops/sec
3,667,761 ops/sec
3,220,451 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| offsetWidth / offsetHeight (destructured and renamed) | |
| offsetWidth / offsetHeight (destructured) | |
| offsetWidth / offsetHeight (simple property access) | |
| getBoundingClientRect() (destructured) | |
| getBoundingClientRect() (simple property access) |
| Test name | Executions per second |
|---|---|
| ✓ offsetWidth / offsetHeight (destructured and renamed) | 15,179,328 Ops/sec |
| offsetWidth / offsetHeight (destructured) | 15,163,370 Ops/sec |
| offsetWidth / offsetHeight (simple property access) | 14,864,196 Ops/sec |
| getBoundingClientRect() (simple property access) | 9,098,546 Ops/sec |
| getBoundingClientRect() (destructured) | 9,060,147 Ops/sec |