clientWidth vs offsetwidth vs window.getComputedStyleFastest: offsetwidth (15.0x faster)
8,653,002 ops/sec
1,096,475 ops/sec
575,297 ops/sec
Fastest: offsetwidth (2.3x faster)
5,157,514 ops/sec
3,455,804 ops/sec
2,213,740 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| clientWidth | |
| offsetwidth | |
| window.getComputedStyle |
| Test name | Executions per second |
|---|---|
| ✓ offsetwidth | 10,946,994 Ops/sec |
| clientWidth | 160,427 Ops/sec |
| window.getComputedStyle | 90,757 Ops/sec |