canvas drawing

JavaScript performance comparison

Test case created

Preparation code

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
 
<script>
Benchmark.prototype.setup = function() {
    var canvas = document.createElement('canvas');
    var ctx = canvas.getContext("2d");
    canvas.width = 640;
    canvas.height = 480;
   
    var fullImage = new Image();
    fullImage.src = "http://warp.povusers.org/pics/GlowTest.jpg";
   
    var overImage = new Image();
    overImage.src = "http://www.sikhnet.com/thegallery/gallery/d/355-2/20060526DuskAtHarimandirSahib-1024x768.jpg";
   
    var quarterImage = new Image();
    quarterImage.src="http://www.kespia.com/pictures/Test_Drive_Unlimited_320x240.jpg";
};
</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
fullimage
ctx.drawImage(fullImage, 0, 0, 640, 480);
pending…
overImage
ctx.drawImage(overImage, 0, 0, 640, 480);
pending…
tiled
ctx.drawImage(quarterImage, 0, 0, 320, 240);
ctx.drawImage(quarterImage, 320, 0, 320, 240);
ctx.drawImage(quarterImage, 0, 240, 320, 240);
ctx.drawImage(quarterImage, 320, 240, 320, 240);
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