canvas-drawImage (v7)

Revision 7 of this benchmark created on


Preparation HTML

<script>
  var c = document.createElement('canvas');
  var ctx = c.getContext('2d');
  c.width = 512;
  c.height = 512;
  
 
  var c2 = document.createElement('canvas');
  var ctx2 = c2.getContext('2d');
  c2.width = 128;
  c2.height = 128;
ctx.fillStyle = 'rgba(0,0,0,0.5)';
  ctx2.fillRect(0, 0, 128, 128);

  var img = new Image();
  img.src = c.toDataURL();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Drawimage Canvas
ctx.save();
ctx.translate(1,1);
ctx.drawImage(c2, 0, 0);
ctx.restore();
ready
Drawimage Image
ctx.save();
ctx.translate(1,1);
ctx.drawImage(img, 0, 0);
ctx.restore();
ready
Scale canvas
ctx.drawImage(c2, 1, 1, 126, 126);
ready
Scale Image
ctx.drawImage(img, 1, 1, 126, 126);
ready
Slice Canvas
ctx.drawImage(c2, 1, 1, 126, 126, 64, 64, 128, 128);
ready
Slice Image
ctx.drawImage(img, 1, 1, 126, 126, 64, 64, 128, 128);
ready

Revisions

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