translate3d vs translate vs css left/top vs css margin (v96)

Revision 96 of this benchmark created on


Preparation HTML

<div id="guide" style="width:100px;height:100px; overflow:hidden"><div id="elem" style="width:100000px; height=100000px">a</div></div>
<script>
  var elem = document.getElementById("elem");
  var wrapper = document.getElementById("guide");
  var style = elem.style;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
translate3d
var x = 0,
    t = '';

for (var i = 200; i--;) {
  x = i * 5;
  t = 'translate3d(' + x + 'px, 0, 0)';
  style.webkitTransform = t;
}
ready
translate
var x = 0,
    t = '';

for (var i = 200; i--;) {
  x = i * 5;
  t = 'translateX(' + x + 'px)';
  style.webkitTransform = t;
}
ready
Test 3
var x = 0,
    t = '';

for (var i = 200; i--;) {
  x = i * 5;
  wrapper.scrollLeft = x;
}
ready

Revisions

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