Test name | Executions per second |
---|---|
offsetWidth | 253784.3 Ops/sec |
getBoundingClientRect | 286272.4 Ops/sec |
canvas | 416033.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')