Canvas save-restore (v3)

Revision 3 of this benchmark created on


Preparation HTML

<canvas id="myCanvas" width="320" height="240"></canvas>
<script>
  var str = "@abcdefghijklmnopqrstuvwxyz";
  var myCanvas = document.getElementById("myCanvas");
  var context2d = myCanvas.getContext("2d");
  var r = [];
  var index = 0;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
save-restore
context2d.save();
context2d.rotate( 3.65 );
context2d.restore();
ready
manual reset
context2d.rotate( 3.65 );
r[index++] = 3.65 ;
context2d.rotate( -r[index--] );
ready

Revisions

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