offsetWidth vs getBoundingClientRect vs canvasFastest: offsetWidth (1.5x faster)
1,381,825 ops/sec
1,285,526 ops/sec
928,617 ops/sec
Fastest: offsetWidth (4.4x faster)
2,900,046 ops/sec
1,594,894 ops/sec
660,019 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| offsetWidth | |
| getBoundingClientRect | |
| canvas |
| Test name | Executions per second |
|---|---|
| ✓ canvas | 1,932,941 Ops/sec |
| offsetWidth | 1,024,466 Ops/sec |
| getBoundingClientRect | 704,847 Ops/sec |