- From: Evgeny Burzak <buzzilo@gmail.com>
- Date: Sun, 14 Nov 2010 11:44:46 +0300
On Sat, 13 Nov 2010 23:20:30 -0500 Boris Zbarsky <bzbarsky at MIT.EDU> wrote: > On 11/13/10 12:20 PM, Evgeny Burzak wrote: > > But , the test results looks similar for all vendors! On average the > > difference in processing speed is about 2-3 times (five times in > > Firefox 4). > > > This is due to the fact that loops take less time (width x > > height * 4 vs. width x height) and arrays with less elements take less > > memory. Though I realize that main idea for data structure was > > simplicity, but in this case it seems simplicity is evil, not good. > > At least Gecko and Webkit implement canvas imagedata as something more > like a WebGL typed array, not a JS array. So in particular, the memory > usage is the same or better as for your "compact" array version (in the > case of Gecko actually 2x better, since your "compact" array uses 8 > bytes per color, while the native imagedata uses 4 bytes per color). > Yes that gives a significant speedup due to less memory traffic and > better cache locality. > > But this is only a problem for emulating canvas, no? And only in UAs > that don't support typed arrays, say. That all seems like a transitory > problem. > Yes, this is local problem for canvas emulator and IE. So which format should I use? A lot of people using WinXP and IE 6-8 at this moment. There are no typed arrays, no fast JS and so on... :( But they may be our clients and don't worry about that. If they see message "Script takes too much time", they say goodbye, it's not for me. This situation will be (probably) five years long or more. So while is it possible to add conversion methods to the typed array? Something like fromArray32() and fromArray8() ? Evgeny
Received on Sunday, 14 November 2010 00:44:46 UTC