Test name | Executions per second |
---|---|
offsetWidth | 495360.4 Ops/sec |
getBoundingClientRect | 582285.1 Ops/sec |
canvas | 731080.0 Ops/sec |
<div>Hello World</div>
const canvas = document.createElement('canvas')
window.context = canvas.getContext('2d')
document.querySelector('div').offsetWidth
document.querySelector('div').getBoundingClientRect().width
window.context.measureText('Hello world')