Comparison of image data structures

Image size is 1000x1000.

This test will create arrays with different image data structures. First as is declared in Canvas spec (array element is an color channel), second is slightly different: element is pixel encoded in 32-bit integer.

In IE is using quiet inefficient memory manager so we can face a problems if trying to using default image data. So as compromise I change data format. With a "compact" format, memory consumption makes half or third of a standard, as a result loops takes less time. For technical details see page source.

For running test, open task manager and push one of buttons above.

Here is my results (WinXP, Internet Explorer 8):

  • default data: 4687 ms
  • "compact" data: 2513 ms
  • On average, algorithms that use "compact" data must be faster in about 2-3 times versus standard image array.

    Note that this problem is local for Enternet Explorer. In some another browsers are used typed arrays. The perfomance gain for "compact" data in Firefox is only 30%.