Canvas test (v4)

Revision 4 of this benchmark created on


Preparation HTML

<canvas id="show" width="256" height="256"></canvas>
<script>
  var ctx = document.getElementById("show").getContext('2d');
    
  ctx.fillStyle = "rgba(255,0,0,.01)";
  ctx.fillRect(64, 64, 128, 128);
  
  var c2 = document.createElement('canvas');
  c2.width = 256;
  c2.height = 256;
  var ctx2 = c2.getContext('2d');
    
  var img = new Image();
  img.src = c.toDataURL();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
01 Image copy
ctx.drawImage(ctx.canvas, 0, 0);
ready
02 Canvas copy
ctx.drawImage(ctx2.canvas, 0, 0);
ready
03 Image scale
ctx.drawImage(ctx.canvas, 0, 0, ctx.canvas.width*2, ctx.canvas.height*2);
ready
04 Canvas scale
ctx.drawImage(ctx2.canvas, 0, 0, ctx2.canvas.width*2, ctx2.canvas.height*2);
ready

Revisions

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