style-vs-clientheight

JavaScript performance comparison

Test case created by dfcreative

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var div = document.createElement("div");
   
    div.style.top = "200px";
    div.style.height = "100px";
    div.style.marginTop = "100px";
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
marginTop
div.style.marginTop
pending…
marginTop2
div.style["margin-top"]
pending…
clientHeight
div.clientHeight
pending…
offset
div.offsetTop
pending…
top
div.style.top
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