canvas (v57)

Revision 57 of this benchmark created by impfromliga on


Preparation HTML

<canvas id="cnv" width="320" height="240">
</canvas>
<img id="img" src="http://mozilla.org/media/img/firefox/template/header-logo-inverse.png" style="display: none" />

Setup

function createCanvas(w, h) {
    var canvas = document.createElement('canvas');
    canvas.setAttribute('width', w);
    canvas.setAttribute('height', h);
    return canvas;
  }
  
  // globals
  var g_ctx = document.getElementById('cnv').getContext('2d');
  var g_img = document.getElementById('img');
  var g_offscreenCtx = createCanvas(g_img.naturalWidth, g_img.naturalHeight).getContext('2d');
  var g_offscreenImg = new Image();
  
  g_offscreenCtx.drawImage(g_img, 0, 0);
  g_offscreenImg.src="http://mozilla.org/media/img/firefox/template/header-logo-inverse.png"

Test runner

Ready to run.

Testing in
TestOps/sec
img
g_ctx.drawImage(g_img, 0, 0);
ready
not-in-dom canvas
g_ctx.drawImage(g_offscreenCtx.canvas, 0, 0);
ready
not-in-dom image
g_ctx.drawImage(g_offscreenImg, 0, 0);
ready

Revisions

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