Canvas image drawing with mirror transform

Benchmark created by Andy on


Description

Tests the performance of drawing an image to the canvas with a null transform vs a mirror transform.

Preparation HTML

<canvas id="surface" width="100" height="100"></canvas>
<script>
  var dest = document.getElementById("surface");
  var context = dest.getContext("2d");
  var source = document.createElement("canvas");
  source.width = 100;
  source.height = 100;
  ui.benchmarks[1].setup = function() {
      // set mirror transform for second test
      context.scale(-1, 1);
  };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Null transform (default)
context.drawImage(source, 0, 0);
ready
Mirror transform (negative horizontal scale)
context.drawImage(source, -100, 0);
ready

Revisions

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