canvas-clear (v23)

Revision 23 of this benchmark created by Thomas Giles on


Description

Different methods for clearing the canvas.

Preparation HTML

<script>
  var c = document.createElement('canvas');
  c.width = c.height = 500;
  var ctx = c.getContext('2d');
  ctx.fillStyle = 'rgba(0,0,0,1)';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
clearRect
ctx.clearRect(0,0,500,500);
 
ready
fillRect
ctx.fillRect(0,0,500,500);
 
ready
set width
c.width = c.width;
 
ready

Revisions

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