translate3d vs translate XY vs css left/top vs scrollleft

JavaScript performance comparison

Revision 126 of this test case created by TakuyaMotoshima

Preparation code

<div style="background:#ccc; width:100px; height:100px;overflow:auto;">
<div id="elem" style="position:absolute;height:1000px;width:50px;background-color:#FF0;"></div>
</div>

    

Preparation code output

<div style="background:#ccc; width:100px; height:100px;overflow:auto;"> <div id="elem" style="position:absolute;height:1000px;width:50px;background-color:#FF0;"></div> </div>

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
translate3d
var elem = document.getElementById("elem");
for (var i=1;i<=100;i++) {
 elem.style.transform = 'translate3d(0,'+i+'px,0)';
}
pending…
Scroll left
var elem = document.getElementById("elem");
for (var i=1;i<=100;i++) {
 elem.scrollTop = -i;
}
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