drawImage from different sources (v48)

Revision 48 of this benchmark created by asdada on


Setup

function createCanvas(w, h) {
    var canvas = document.createElement('canvas');
    canvas.setAttribute('width', w);
    canvas.setAttribute('height', h);
    return canvas;
  }
  
  // globals
  var g_ctx = createCanvas(1280, 720).getContext('2d');
  var g_img = new Image();
  g_img.src = 'http://puu.sh/k5PrB.png'; //1280x1280
  var g_offscreenCanvas = createCanvas(1280, 720);
  
  g_offscreenCanvas.getContext('2d').drawImage(g_img, 0, 0);
  
  var x = Math.floor(Math.random() * 100);
  var y = Math.floor(Math.random() * 100);

Teardown



            x = Math.floor(Math.random() * 100);
  y = Math.floor(Math.random() * 100);
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
img
g_ctx.drawImage(g_img, x, y, 1280/2, 720/2, 0, 0, 1280, 700);
ready
not-in-dom canvas
g_ctx.drawImage(g_offscreenCanvas, x, y, 1280/2, 720/2, 0, 0, 1280, 700);
ready

Revisions

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