clearRect vs. fillRect

JavaScript performance comparison

Revision 5 of this test case created

Preparation code

<canvas id="canvas" width="10" height="10"></canvas>
<script>
  var ctx = document.getElementById("canvas").getContext("2d");
  ctx.fillStyle = "#000000";
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
clearRect
ctx.clearRect(0, 0, 10, 10);
pending…
fillRect
ctx.fillRect(0, 0, 10, 10);
pending…
rect with fill
ctx.beginPath();
ctx.rect(0,0,10,10);
ctx.fill();
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment