translate vs translate XY

JavaScript performance comparison

Revision 43 of this test case created by Donato

Preparation code

<div id="elem" style="position: absolute; background:#ccc; width:10px; height:10px;"></div>
<script>
  var elem = document.getElementById("elem");
  var style = elem.style;
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

    

Preparation code output

<div id="elem" style="position: absolute; background:#ccc; width:10px; height:10px;"></div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Using Translate3d
$elem = $(elem);

for (var i = 100; i--;) {
 $elem.css("-webkit-transform", "translate3d(0, "+y+"px, 0)");
}
pending…
Using Top
$elem = $(elem);

for (var i = 100; i--;) {
 $elem.css("top", i+ "px");
}
pending…
translateX
pending…

Compare results of other browsers

Revisions

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

0 Comments