getImageData Performance (v11)

Revision 11 of this benchmark created on


Description

Checking to see the performance of getImageData for various widths and heights, using a small (in some browsers non-hardware accelerated) source canvas.

Preparation HTML

<script language="JavaScript">
  var canvas = document.createElement('canvas');
  canvas.width = 100;
  canvas.height = 100;
  var context = canvas.getContext('2d');
  context.fillStyle = '#abc';
  context.fillRect(0, 0, 100, 100);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
One Pixel
var data = context.getImageData(0, 0, 1, 1);
console.log(data)
ready
One Pixel Center
var data = context.getImageData(50, 50, 1, 1);
ready
10 by 10
var data = context.getImageData(0, 0, 10, 10);
ready
30 by 30
var data = context.getImageData(0, 0, 30, 30);
ready
90 by 1
var data = context.getImageData(0, 0, 90, 1);
ready
1 by 90
var data = context.getImageData(0, 0, 1, 90);
ready
100 by 100
var data = context.getImageData(0, 0, 100, 100);
ready
1 by 100
var data = context.getImageData(0, 0, 1, 100);
ready
Perimeter
var data = context.getImageData(0, 0, 1, 100);
data = context.getImageData(0, 99, 1, 100);
data = context.getImageData(0, 1, 98, 1);
data = context.getImageData(99, 1, 1, 98);
ready
Small Perimeter
var data = context.getImageData(0, 0, 1, 30);
data = context.getImageData(0, 29, 1, 30);
data = context.getImageData(0, 1, 28, 1);
data = context.getImageData(29, 1, 1, 28);
ready
Smaller Perimeter
var data = context.getImageData(0, 0, 1, 100);
data = context.getImageData(0, 99, 1, 100);
data = context.getImageData(0, 1, 98, 1);
data = context.getImageData(99, 1, 1, 98);
ready
One Pixel Again
var data = context.getImageData(0, 0, 1, 1);
ready
5 pixels
var data = context.getImageData(0, 0, 1, 1);
data = context.getImageData(1, 1, 1, 1);
data = context.getImageData(2, 2, 1, 1);
data = context.getImageData(3, 3, 1, 1);
data = context.getImageData(4, 4, 1, 1);
ready

Revisions

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