canvasclear

JavaScript performance comparison

Test case created by Simon

Preparation code

<canvas id="canvas1" width="500" height="500"></canvas>
<script>
  var can = document.getElementById('canvas1');
  var ctx = can.getContext('2d');
</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
setting width
can.width = can.width;
pending…
clearing non-transformed canvas
ctx.clearRect(0, 0, can.width, can.height);
pending…
clearing transformed canvas
// I have lots of transforms right now
ctx.save();
ctx.setTransform(1, 0, 0, 1, 0, 0);
// Will always clear the right space
ctx.clearRect(0, 0, can.width, can.height);
ctx.restore();
// Still have my old transforms
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