Canvas save-restore (v11)

Revision 11 of this benchmark created by muffin on


Preparation HTML

<canvas id="myCanvas" width="1920" height="1200"></canvas>
<script>
  var str = "@abcdefghijklmnopqrstuvwxyz";
  var myCanvas = document.getElementById("myCanvas");
  var context2d = myCanvas.getContext("2d");
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
save-restore
context2d.save();
context2d.globalCompositeOperation = 'lighter';
context2d.globalAlpha = 0.5;
context2d.drawImage(context2d.canvas, 0, 0);
context2d.restore();
ready
manual reset
context2d.globalCompositeOperation = 'lighter';
context2d.globalAlpha = 0.5;
context2d.drawImage(context2d.canvas, 0, 0);
context2d.globalCompositeOperation = 'source-over'
context2d.globalAlpha = 1.0;
 
ready

Revisions

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