dojo.position vs offsetWidth

Benchmark created by woody on


Description

Which is faster reading the offsetWidth or dojo.position (which uses bounding client rect)

Preparation HTML

<div id="test">
<p>Some text </p>
</div><script src="//ajax.googleapis.com/ajax/libs/dojo/1/dojo/dojo.xd.js"></script>

Setup

var node = dojo.byId("test");

Test runner

Ready to run.

Testing in
TestOps/sec
offsetWidth
var x = node.offsetWidth;
ready
position
var x = dojo.position(node).w;
ready

Revisions

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