canvasclear (v19)

Revision 19 of this benchmark created on


Preparation HTML

<canvas id="canvas1" width="960" height="640"></canvas>
<script>
  var dst = document.getElementById('canvas1');

  var offscreen = document.createElement("canvas");
  offscreen.width = dst.width;
  offscreen.height = dst.height;

  var dst_ctx = dst.getContext('2d');
  var offscreen_ctx = offscreen.getContext('2d');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Setting width to clear
offscreen_ctx.strokeRect(10, 10, 50, 50);

dst.width = dst.width;

dst_ctx.drawImage(offscreen,
  0, 0, offscreen.width, offscreen.height,
  0, 0, dst.width, dst.height);
ready
clearRect
offscreen_ctx.strokeRect(10, 10, 50, 50);

dst_ctx.clearRect(0, 0, dst.width, dst.height);

dst_ctx.drawImage(offscreen,
  0, 0, offscreen.width, offscreen.height,
  0, 0, dst.width, dst.height);
ready
globalCompositeOperation
offscreen_ctx.strokeRect(10, 10, 50, 50);

dst_ctx.globalCompositeOperation = "copy";

dst_ctx.drawImage(offscreen,
  0, 0, offscreen.width, offscreen.height,
  0, 0, dst.width, dst.height);
ready

Revisions

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