Outside/Inside Canvas

JavaScript performance comparison

Revision 15 of this test case created by Sev

Info

Is is faster to draw something outside the canvas?

Preparation code

<canvas id="c" width="640" height="480"></canvas>
<script>
  var canvas = document.getElementById('c');
  var context = canvas.getContext('2d');
  context.fillStyle = '#ffcc00';
 
  var HEIGHT = 100;
</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
draw inside
context.fillRect(50,50,100,20);
 
pending…
draw outside
context.fillRect(500,500,100,20);
 
pending…
draw expensive inside
context.arc(50, 50, 40, 0, 1);
context.fill();
pending…
draw expensive outside
context.arc(5000, 5000, 40, 0, 1);
context.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