Partial Re-rendering (v13)

Revision 13 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 (black rect)
for (var i = 0; i < canvas.width; i++) {
  context.fillStyle = 'black';
  context.fillRect(0, 0, canvas.width, canvas.height);
  context.fillStyle = 'white';
  context.fillRect(i, HEIGHT, 5, 5);
}
ready
only render differences
for (var i = 0; i < canvas.width; i++) {
  context.fillStyle = 'black';
  context.fillRect(i - 1, HEIGHT, 5, 5);
  context.fillStyle = 'white';
  context.fillRect(i, HEIGHT, 5, 5);
}
ready
re-render whole scene (clear rect)
for (var i = 0; i < canvas.width; i++) {
  context.clearRect(0, 0, canvas.width, canvas.height);
  context.fillStyle = 'white';
  context.fillRect(i, HEIGHT, 5, 5);
}
ready

Revisions

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