clearRect vs. fillRect (v4)

Revision 4 of this benchmark created on


Preparation HTML

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

Test runner

Ready to run.

Testing in
TestOps/sec
clearRect
ctx.clearRect(0, 0, 1000, 1000);
ready
fillRect
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, 1000, 1000);
ready
clearRect with restore
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, 1000, 1000);
ctx.restore();
ready

Revisions

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