Canvas getImageData

JavaScript performance comparison

Revision 9 of this test case created by

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, multiple slices
var canvas = document.createElement("canvas")
canvas.width = 2000
canvas.height = 2000
var ctx = canvas.getContext("2d")
data1 = ctx.getImageData(0, 0, 256, 256)
data1 = ctx.getImageData(250, 0, 256, 256)
data1 = ctx.getImageData(500, 0, 256, 256)
data1 = ctx.getImageData(750, 0, 256, 256)
data1 = ctx.getImageData(1000, 0, 256, 256)
data1 = ctx.getImageData(1250, 0, 256, 256)
data1 = ctx.getImageData(1500, 0, 256, 256)
data1 = ctx.getImageData(1750, 0, 256, 256)
data1 = ctx.getImageData(1000, 0, 256, 256)
data1 = ctx.getImageData(0, 0, 256, 256)
data1 = ctx.getImageData(250, 250, 256, 256)
data1 = ctx.getImageData(500, 250, 256, 256)
data1 = ctx.getImageData(750, 250, 256, 256)
data1 = ctx.getImageData(1000, 250, 256, 256)
data1 = ctx.getImageData(1250, 250, 256, 256)
data1 = ctx.getImageData(1500, 250, 256, 256)
data1 = ctx.getImageData(1750, 250, 256, 256)
data1 = ctx.getImageData(1000, 250, 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…
multiple tiles
var data = []
for (var x = 0; x < 64; x++) {
  var canvas = document.createElement("canvas");
  canvas.width = 256;
  canvas.height = 256;
  data.push(canvas.getContext("2d").getImageData(0, 0, 256, 256));
  delete canvas;
}
pending…
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…

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