[whatwg] createImageData

Oliver Hunt oliver at apple.com
Tue May 13 15:37:04 PDT 2008

>> That said I still don't believe custom objects should be allowed,  
>> aside from the resolution (which may or may not be relevant) and  
>> performance issues, a custom object with a generic JS array, rather  
>> than an ImageData object will have different behaviour -- a proper  
>> ImageData will clamp on assignment, and throw in cases that a  
>> custom object won't.
> That verification seems odd; doing those checks (clamping,  
> conversion to number) on every single pixel assignment is going the  
> wrong direction for performance -- you really want to validate  
> everything at once.
But by delaying clamping, etc you are requiring that the backing store  
be an array of boxed values, leading to increased memory usage,  
increased indirection, and increasing the cost of the final blit.

My experience implementing this in WebKit showed a pure byte array  
backing store was significantly faster than using boxed values.

>    - Vlad


More information about the whatwg mailing list