preserve-3d (v29)

Revision 29 of this benchmark created by atrl on


Preparation HTML

<div id="elem" style="background:#ccc; width:10px; height:10px;">
</div>
<script>
  var elem = document.getElementById("elem");
  var style = elem.style;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
3d
var x = y = 0;
for (var i = 100; i--;) {
  x = i;
  y = i * 5;
  var transform = 'translate3d(' + x + 'px, ' + y + 'px, 0)';
  style.MozTransform = transform;
  style.webkitTransform = transform;
  elem._width = elem.offsetWidth;
}
ready
3d+preserve-3d
var x = y = 0;
for (var i = 100; i--;) {
  x = i;
  y = i * 5;
  var transform = 'translate3d(' + x + 'px, ' + y + 'px, 0)';
  style.MozTransformStyle = 'preserve-3d';
  style.webkitTransformStyle = 'preserve-3d';
  style.MozTransform = transform;
  style.webkitTransform = transform;
  elem._width = elem.offsetWidth;
}
ready
2d
var x = y = 0;
for (var i = 100; i--;) {
  x = i;
  y = i * 5;
  var transform = 'translate(' + x + 'px, ' + y + 'px)';
  style.MozTransform = transform;
  style.webkitTransform = transform;
  elem._width = elem.offsetWidth;
}
ready
2d+preserve-3d
var x = y = 0;
for (var i = 100; i--;) {
  x = i;
  y = i * 5;
  var transform = 'translate(' + x + 'px, ' + y + 'px)';
  style.MozTransformStyle = 'preserve-3d';
  style.webkitTransformStyle = 'preserve-3d';
  style.MozTransform = transform;
  style.webkitTransform = transform;

  elem._width = elem.offsetWidth;
}
ready

Revisions

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