Test name | Executions per second |
---|---|
offsetWidth | 1443959.0 Ops/sec |
getBoundingClientRect | 1277424.8 Ops/sec |
canvas | 1167941.2 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')