getBoundingClientRect vs clientWidth (v3)

Revision 3 of this benchmark created on


Description

Which is faster reading the clientWidth or getBoundingClientRect

Preparation HTML

<div id="test">
<p>Some text </p>
</div>

Setup

var node = document.getElementById('test');

Test runner

Ready to run.

Testing in
TestOps/sec
clientWidth
var x = node.clientWidth;
ready
getBoundingClientRect
var x = node.getBoundingClientRect();
ready
offsetWidth
var x = node.offsetWidth;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.