Canvas Double Buffering Performance

Benchmark created on


Preparation HTML

<canvas width="800" height="600" id="live"></canvas>

<canvas width="800" height="600" style="display:none;visibility:hidden" id="buffer"></canvas>

<script>
  var liveCtx = document.getElementById("live").getContext("2d");
  var bufferCtx = document.getElementById("live").getContext("2d");
  function drawCircle(ctx,x,y,size){
                ctx.lineWidth=1;
                ctx.fillStyle="#FFFFFF";
                ctx.beginPath();
                ctx.arc(x, y, size, 0, Math.PI*2, true); 
                ctx.closePath();
                ctx.fill();
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Draw Live
drawCircle(liveCtx,Math.random()*700|0,Math.random()*500|0,Math.random()*75|0);
ready
Draw Buffer
drawCircle(bufferCtx,Math.random()*700|0,Math.random()*500|0,Math.random()*75|0);
liveCtx.drawImage(bufferCtx.canvas,0,0);
ready

Revisions

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