vladimir at mozilla.com
Tue Apr 2 12:02:50 PDT 2013
On 4/1/2013 10:24 PM, Kenneth Russell wrote:
> On Sun, Mar 31, 2013 at 1:42 PM, Kevin Gadd <kevin.gadd at gmail.com> wrote:
>> One could also argue that people using typed arrays to alias and munge
>> individual values should be using DataView instead. If it performs poorly,
>> that can hopefully be addressed in the JS runtimes (the way it's specified
>> doesn't seem to prevent it from being efficient).
> Agreed. DataView's methods are all simple and should be easy to
> optimize. Because they include a conditional byte swap, they can't run
> quite as fast as the typed arrays' accessors -- but they shouldn't
> need to.
Side note: in theory they could run extremely fast, as long as the
endianness parameter was a constant. Since you generally know the
format of the data coming over the network, it should be except in rare
cases. The implementation knows the native endianness and can just
choose the right load/store variant when generating JIT code for the
call. However, they can also read from unaligned offsets, and so that
will slow things down a bit. Either way -- they could be much faster
than they are now.
More information about the es-discuss