getBoundingClientRect vs getClientRects

Benchmark created by shwups on


Preparation HTML

<div>
   <div id="test" style="border:1px solid red; position:absolute; top:20px; left:20px; height:20px; width:20px">
</div>

Setup

window.el = document.getElementById('test')
    window.y = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
getBoundingClientRect
x = el.getBoundingClientRect()
y.top += x.top
ready
getClientRects
x = el.getClientRects()
y.top += x[0].top
ready

Revisions

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

  • Revision 1: published by shwups on