HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 36 community runs

Desktop Results:
Chrome 30 runs
offsetWidth
1.4M/s
canvas
1.3M/s
getBoundingClientRect
929K/s

Fastest: offsetWidth (1.5x faster)

View exact numbers
  • offsetWidth: 1,381,825 ops/sec
  • canvas: 1,285,526 ops/sec
  • getBoundingClientRect: 928,617 ops/sec
Firefox 6 runs
offsetWidth
2.9M/s
getBoundingClientRect
1.6M/s
canvas
660K/s

Fastest: offsetWidth (4.4x faster)

View exact numbers
  • offsetWidth: 2,900,046 ops/sec
  • getBoundingClientRect: 1,594,894 ops/sec
  • canvas: 660,019 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    offsetWidth
    getBoundingClientRect
    canvas

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0
Chrome 149 on Windows
View result in a separate tab
canvas
1.9M/s
offsetWidth
1.0M/s
getBoundingClientRect
705K/s
View exact numbers
Test name Executions per second
canvas 1,932,941 Ops/sec
offsetWidth 1,024,466 Ops/sec
getBoundingClientRect 704,847 Ops/sec