canvas-drawImage (v6)

Revision 6 of this benchmark created by Georg Petschnigg on


Preparation HTML

<script>
  var c = document.createElement('canvas');
  c.width = 256;
  c.height = 256;
  
  var ctx = c.getContext('2d');
  ctx.fillRect(64, 64, 128, 128);
  
  var img = new Image();
  img.src = c.toDataURL();
  
  var c2 = document.createElement('canvas');
  c2.width = 512;
  c2.height = 512;
  var ctx2 = c2.getContext('2d');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
aligned
ctx2.drawImage(c, 128, 128);
 
ready
offset
ctx2.drawImage(c, 128.5, 128.5);
 
ready
scaled
ctx2.save();
ctx2.scale(0.95, 1.05);
ctx2.drawImage(c, 128, 128);
ctx2.restore();

 
ready
aligned img
ctx2.drawImage(img, 128, 128);
 
ready
offset img
ctx2.drawImage(img, 128.5, 128.5);
 
ready
scaled img
ctx2.save();
 ctx2.scale(0.95, 1.05);
 ctx2.drawImage(img, 128, 128);
 ctx2.restore();
 
ready

Revisions

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