Canvas getImageData

JavaScript performance comparison

Test case created by alastair

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
    

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
one tile
var canvas = document.createElement("canvas")
canvas.width = 2000
canvas.height = 2000
var ctx = canvas.getContext("2d")
data = ctx.getImageData(0, 0, 2000, 2000)
pending…
multiple tiles
var canvases = []
for (var x = 0; x < 8; x++) {
  var canvas = document.createElement("canvas");
  canvas.width = 256;
  canvas.height = 256;
  canvases.push(canvas)
}

for (var x =0;x<canvases.length;x++) {
 o = canvases[x].getContext("2d").getImageData(0,0,256,256);
}
pending…
larger tiles
var canvases = []
for (var x = 0; x < 4; x++) {
  var canvas = document.createElement("canvas");
  canvas.width = 512;
  canvas.height = 512;
  canvases.push(canvas)
}

for (var x =0;x<canvases.length;x++) {
 o = canvases[x].getContext("2d").getImageData(0,0,256,256);
}
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.

0 Comments