canvas clear

Benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
single
var w = can.width;
var h = can.height;
ctx.clearRect(0, 0, w, h);
ready
tiled
var x = 0;
var y = 0;
var s = 32;
var w = can.width;
var h = can.height;

for (x = 0; x * s < w + s; x++) {
  for (y = 0; y * s < h + s; y++) {
    ctx.clearRect(x, y, s, s);
  }
}
ready

Revisions

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