On Thu, 30 Oct 2014 09:29:36 +0100, Florian Bösch <[email protected]> wrote:
> The usecases:
>
> [...]
>
> *3) Initializing an existing array with a repeated numerical value*
>
> For audio processing, physics and a range of other tasks it's important to
> initialize an array with the same data.
>
> for(var i=0; i<size; i++){ someArray[i] = 0; }
For this use case there is %TypedArray%.prototype.fill(), see:
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-%typedarray%.prototype.fill
JavaScript engines are expected to implement it at some point. For example
I am implementing this in V8, along with other new typed array methods. The
engines should be able to generate quite good code for uses of this function
and/or provide optimized versions relying on knowledge of the underlying
element type of the typed array they are applied to.
Cheers,
--
☺ Adrián
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss