drawImage whole pixels

JavaScript performance comparison

Test case created

Preparation code

<canvas id="screen"></canvas>
<script>
  var ctx = document.getElementById("screen").getContext("2d");
  var image = document.createElement("img");
  image.src = "http://icons.iconarchive.com/icons/ph03nyx/super-mario/48/Retro-Mushroom-1UP-2-icon.png";
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
whole pixel
ctx.drawImage(image, 0, 0);
pending…
sub pixel
ctx.drawImage(image, 0.5, 0.5);
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

3 comments

hallvar commented :

Weird that I got more ops/sec with subpixel draw.

Testing in Chrome 8.0.552.224 on Windows 7

whole pixel 6,655 ±6.84% 11% slower

sub pixel 7,542 ±4.43% fastest

uejji commented :

Same here

Testing in Chrome 8.0.552.224 on Windows 7 whole pixel 2,176 ±5.30% fastest sub pixel 2,361 ±3.74% fastest

Seb Lee-Delisle commented :

I've found that sub-pixel drawing is WAY slower on OSX than it is on Windows. Would be good if browsers were also grouped into OS, right? :)

Add a comment