translate vs translate XY

JavaScript performance comparison

Revision 44 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="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Using Translate3d
$elem = $(elem);

for (var i = 100; i--;) {
 $elem.css("-webkit-transform", "translate3d(0, "+i+"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. Here’s a list of current revisions for this page:

0 comments

Add a comment