clip dither test

Benchmark created by madmonkey on


Preparation HTML

<!DOCTYPE html>
<html>
<body>
<center>
<canvas id="myCanvas" width="32" height="40">
Your browser doesn't support the canvas.
</canvas>
</center>
<script src="//cdn.ext/library.js"></script>
</body>
</html>

Setup

var canvas = document.getElementById("myCanvas");
    var ctx = canvas.getContext("2d");
    var canvasWidth = canvas.width;
    var canvasHeight = canvas.height;
    var block = new Image();
    block.src = "https://dl.dropboxusercontent.com/u/134665186/test2.png";

Test runner

Ready to run.

Testing in
TestOps/sec
no dither
ctx.drawImage(block, 0, 0);
ready
dither
for (var i = 0; i < canvasWidth / 2; i++) {
  for (var j = 0; j < canvasHeight / 2; j++) {
    if (i % 2 == 0) {
      ctx.rect(i * 2, j * 2, 1, 1);
    } else {
      ctx.rect(i * 2, j * 2 + 1, 1, 1);
    }
  }
}
ctx.clip();
ctx.drawImage(block, 0, 0);
ready

Revisions

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