translate3d vs translate XY vs css left/top

JavaScript performance comparison

Revision 53 of this test case created

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>

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
translate3d
var x = y = 0;
for (var i = 100; i--;) {
 x = y = i;
 style.WebkitTransform = 'translate3d(' + x + 'px, '+y+'px, 0)';
}
pending…
translate
var x = y = 0;
for (var i = 100; i--;) {
 x = y= i;

 style.WebkitTransform = 'translate(' + x + 'px, '+y+'px)';

}
pending…
css left/top
var x = y = 0;
for (var i = 100; i--;) {
 x = y = i;
 style.left = x + 'px';
 style.top = y + 'px';
}
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