Comparing Onscreen & Offscreen Rendering to Canvas

JavaScript performance comparison

Test case created by M.


Just a quick test to see if their is any performance penalty in drawing off-screen (partially or fully) to a canvas.

Preparation code

<script src=""></script>
    var cntx = null;
    window.addEvent('domready', function() {
        cntx = $('surface').getContext('2d');

<canvas id="surface" width="500" height="350" style="border: 1px solid #CCC;"></canvas>
Benchmark.prototype.setup = function() {

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
Within Bounds
cntx.fillRect(40, 50, 30, 40);
Partially Within Bounds
cntx.fillRect(-10, -20, 30, 40);
Out of Bounds
cntx.fillRect(-60, -70, 30, 40);

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

Compare results of other browsers

1 comment

Comment form temporarily disabled.

Add a comment