HTML Preparation code:
AخA
 
1
<div>Hello World</div>
Script Preparation code:
 
const canvas = document.createElement('canvas')
window.context = canvas.getContext('2d')
Tests:
  • offsetWidth

     
    document.querySelector('div').offsetWidth
  • getBoundingClientRect

     
    document.querySelector('div').getBoundingClientRect().width
  • canvas

     
    window.context.measureText('Hello world')
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    offsetWidth
    getBoundingClientRect
    canvas

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Chrome 132 on Windows
View result in a separate tab
Test name Executions per second
offsetWidth 1853242.8 Ops/sec
getBoundingClientRect 1216827.5 Ops/sec
canvas 2120231.2 Ops/sec