drawImage whole pixels

JavaScript performance comparison

Revision 26 of this test case created by ramin

Preparation code

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>2</title>


<script src="app/javascript/easeljs-0.7.0.min.js"></script>
<script src="app/javascript/tweenjs-0.5.0.min.js"></script>
<script src="app/javascript/movieclip-0.7.0.min.js"></script>
<script src="app/javascript/preloadjs-0.4.0.min.js"></script>



<script src="app/javascript/soundjs-0.5.0.min.js"></script>
<script src="2.js"></script>

<script>
var canvas, stage, exportRoot;

function init() {
        canvas = document.getElementById("canvas");
        images = images||{};

        var loader = new createjs.LoadQueue(false);
        loader.installPlugin(createjs.Sound);
        loader.addEventListener("fileload", handleFileLoad);
        loader.addEventListener("complete", handleComplete);
        loader.loadManifest(lib.properties.manifest);
}

function handleFileLoad(evt) {
        if (evt.item.type == "image") { images[evt.item.id] = evt.result; }
}

function handleComplete() {
        exportRoot = new lib._2();

        stage = new createjs.Stage(canvas);
        stage.addChild(exportRoot);
        stage.update();

        createjs.Ticker.setFPS(lib.properties.fps);
        createjs.Ticker.addEventListener("tick", stage);
}

function playSound(id, loop) {
        createjs.Sound.play(id, createjs.Sound.INTERRUPT_EARLY, 0, 0, loop);
}

</script>
</head>

<body onload="init();" style="background-color:#D4D4D4">
        <canvas id="canvas" width="1280" height="720" style="background-color:#FFFFFF"></canvas>
</body>
</html>

Preparation code output

2

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
whole pixel
ctx.drawImage(image, 0, 0);
pending…
sub pixel
ctx.drawImage(image, 0.5, 0.5);
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