On May 27, 2010, at 2:55 PM, Brendan Eich wrote:

With typed arrays, you have to make two views of the array I sketched, one a uint32 array and the other a uint8 array, and use them both to load and store the appropriate "members": x, y, and z are via the uint32 view, r/g/b/a are via the uint8 view. But there is no "struct" or ensemble of all 16 bytes that you can load and store efficiently with typed arrays.

Same with the struct-schema idea.

But, I should have added, with the struct-schema idea, at least you can reify an object representing the whole struct. Which I think is winning, even if it's a low-perf path. The typed array aliasing has no such aggregate view AFAIK.

Someone might object that this is a footgun, but performance-minded hackers know how to avoid slowdowns. And apples-to-apples comparison with typed arrays only ever loads or stores the primitive-typed fields, not whole structs.

/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to