canvasclear (v24)

Revision 24 of this benchmark created on


Preparation HTML

<canvas id="canvas1" width="1000" height="1000"></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
use background color
ctx.fillStyle = "#ffffff";
ctx.fillRect(0, 0, can.width, can.height);
ready
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, can.width, can.height);
ctx.fillStyle = '#000';
ctx.fillText('Hello World!', 50, 50);
ready
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, can.width, can.height);
ready
can.width = can.width;
ctx.fillText('Hello World!', 50, 50);
ready
ctx.clearRect(0, 0, can.width, can.height);
ctx.fillText('Hello World!', 50, 50);
ready

Revisions

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