getComputedStyle Perf (v2)

Revision 2 of this benchmark created on


Preparation HTML

<div id="test" style="box-sizing:content-box;"></div>
<div id="test2" style="box-sizing:content-box;"></div>
<script>
if (!window.getComputedStyle)
{ 
 window.getComputedStyle =
  function (element)
  {
   return element.currentStyle;
  }
}
var div = document.getElementById("test"),
 div2 = document.getElementById("test2"),
 gCS = window.getComputedStyle(div);

</script>

Test runner

Ready to run.

Testing in
TestOps/sec
gCS, access, then set
gCS = window.getComputedStyle(div);
div.style.boxSizing = gCS.boxSizing;
ready
just set
div.style.boxSizing = "content-box";
ready
access then set
div.style.boxSizing = gCS.boxSizing;
ready
style access then set
div.style.boxSizing = div.style.boxSizing;
ready
gCS, access, then set to other
gCS = window.getComputedStyle(div);
div2.style.boxSizing = gCS.boxSizing;
ready

Revisions

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