drawImage whole pixels

JavaScript performance comparison

Test case created by

Preparation code

<canvas id="screen"></canvas>
  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";

Preparation code output

<canvas id="screen"></canvas>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
whole pixel
ctx.drawImage(image, 0, 0);
sub pixel
ctx.drawImage(image, 0.5, 0.5);

Compare results of other browsers


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


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? :)