W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2008

[whatwg] createImageData

From: Oliver Hunt <oliver@apple.com>
Date: Tue, 13 May 2008 15:37:04 -0700
Message-ID: <B483364C-AA4F-405F-BDEB-4081071B43B9@apple.com>
>> 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

--Oliver
Received on Tuesday, 13 May 2008 15:37:04 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:02 UTC