getclientWidth vs getboundingclientrect

JavaScript performance comparison

Test case created by npjohns

Preparation code

<div id="a">asdf</div>
<script>
Benchmark.prototype.setup = function() {
    var a = document.getElementById('a');
};
</script>

Preparation code output

asdf

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
clientwidth
var b = a.clientWidth;
pending…
rect
var b = a.getBoundingClientRect();
pending…

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

Compare results of other browsers

0 comments

Add a comment