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.2x faster)
1,255,500 ops/sec
1,251,890 ops/sec
1,209,668 ops/sec
1,070,559 ops/sec
1,052,012 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 |
|---|---|
| ✓ getBoundingClientRect() (simple property access) | 2,582,263 Ops/sec |
| getBoundingClientRect() (destructured) | 2,273,136 Ops/sec |
| offsetWidth / offsetHeight (destructured and renamed) | 1,579,084 Ops/sec |
| offsetWidth / offsetHeight (destructured) | 1,416,023 Ops/sec |
| offsetWidth / offsetHeight (simple property access) | 1,387,377 Ops/sec |