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

     
    window.div.offsetWidth
  • getBoundingClientRect

     
    window.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: 19 days ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
offsetWidth 102391384.0 Ops/sec
getBoundingClientRect 14883316.0 Ops/sec
canvas 3026496.5 Ops/sec