canvasclear (v8)

Revision 8 of this benchmark created on


Preparation HTML

<canvas id="canvas1" width="500" height="500"></canvas>
<script>
  var can = document.getElementById('canvas1');
  var ctx = can.getContext('2d');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
setting width
can.width = can.width;
ready
clearing non-transformed canvas
ctx.clearRect(0, 0, can.width, can.height);
ready
clearing transformed canvas
// I have lots of transforms right now
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
// Will always clear the right space
ctx.clearRect(0, 0, can.width, can.height);
ctx.restore();
// Still have my old transforms
ready
clearing transformed canvas 2
// I have lots of transforms right now that I don't need to save
ctx.setTransform(1, 0, 0, 1, 0, 0);
// Will always clear the right space
ctx.clearRect(0, 0, can.width, can.height);
ready
save-restore
// Initially:
ctx.save();
// Later:
ctx.restore();
ctx.clearRect(0, 0, can.width, can.height);
ready

Revisions

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