Canvas Image

JavaScript performance comparison

Test case created by Daniel Baulig (Ba. Thesis)

Preparation code

<canvas width="800" height="600" id="canvas"></canvas>
<script>
  var canvas = document.getElementById('canvas');
  var context = canvas.getContext('2d');
  var images = [new Image(), new Image(), new Image(), new Image()];
  var w = canvas.width,
      h = canvas.height;
 
  images[0].src = 'http://www.w3.org/html/logo/downloads/HTML5_Badge_512.png';
  images[1].src = 'http://www.w3.org/html/logo/downloads/HTML5_Badge_128.png';
  images[2].src = 'http://www.w3.org/html/logo/downloads/HTML5_Badge_32.png';
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Large Image
context.drawImage(images[0], 0, 0);
pending…
Medium Image
context.drawImage(images[1], 0, 0);
pending…
Small Image
context.drawImage(images[2], 0, 0);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment