canvas-clear

JavaScript performance comparison

Revision 6 of this test case created

Info

Different methods for clearing the canvas.

Preparation code

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

  var angle = Math.PI/4;


</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
非自己管理
   ctx.save();
   ctx.translate(100  , 0);
   ctx.rotate(angle);
   ctx.fillRect(0 , 0 , 20 , 20);
   ctx.restore();
pending…
自己管理
   var fs = Math.sin(angle);
   var fc = Math.cos(angle);

   ctx.save();
   ctx.setTransform(fc , fs , -fs, fc ,100 , 0);
   ctx.fillRect(0 , 0 , 20 , 20);
   ctx.restore();
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