Partial Re-rendering (v7)

Revision 7 of this benchmark created on


Preparation HTML

<canvas id="c" width="640" height="480">
</canvas>
<script>
  var canvas = document.getElementById('c');
  var context = canvas.getContext('2d');

  var HEIGHT = 100;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
re-render whole scene
context.fillStyle = 'red';
var angle = 0;
var dist  = 0;
for (var i = 0; i < canvas.width; i++) {
     context.clearRect(0 , 0 , canvas.width , canvas.height);
      context.save();
      context.translate(dist +=0.5  , 0);
      context.rotate(angle  += 0.2);
      context.fillRect(0 , 100 , 20 , 20);
      context.restore();

}
ready
only render differences
context.fillStyle = 'red';
var angle = 0;
var dist  = 0;
for (var i = 0; i < canvas.width; i++) {
      context.clearRect(0 , 0 , canvas.width , canvas.height);
      context.save();      
	    var fs = Math.sin(angle);
	    var fc = Math.cos(angle);
      angle += 0.2;
      context.setTransform(fc , fs ,fs ,fc , dist += 0.5 , 0 );
      context.fillRect(0 , 100 , 20 , 20);
      context.restore();
}
ready

Revisions

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