Test name | Executions per second |
---|---|
clientHeight | 1281814.5 Ops/sec |
offsetHeight | 1310361.8 Ops/sec |
getBoundingClientRect | 837368.9 Ops/sec |
<div id="el">
<h2>Lorem ipsum dolor sit amet</h2>
</div>
var el = document.getElementById("el");
const { clientHeight } = el;
const perim = (clientHeight) * 2;
const { offsetHeight } = el;
const perim = (offsetHeight) * 2;
const { height } = el.getBoundingClientRect();
const perim = (height) * 2;