getBoundingClientRect vs jQuery (v3)

Revision 3 of this benchmark created by David Warkentin on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<div id="foo" style="width:500px; height:500px; padding:10px; border:10px solid #000000;">
</div>

Setup

var foo = document.getElementById('foo');
    var $foo = $(foo);

Test runner

Ready to run.

Testing in
TestOps/sec
getBoundingClientRect
foo.getBoundingClientRect()
ready
jQuery
$.extend({}, $foo.offset(), {
  width: foo.offsetWidth,
  height: foo.offsetHeight
})
ready
jQuery (offset only)
$foo.offset()
ready

Revisions

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