Test name | Executions per second |
---|---|
offsetWidth | 739665.6 Ops/sec |
getBoundingClientRect | 906682.8 Ops/sec |
canvas | 1197757.8 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')