On Tue, Oct 28, 2014 at 5:58 PM, Jussi Kalliokoski <email@example.com> wrote:I think while it can be improved, set() is pretty good for memset, but FWIW in the case of filling arrays with arbitrary data, native implementations won't be of much help. I like to think of JS as a distributed system in terms of performance, where you want to pass small data in close proximity and larger data when the distance grows (where native implementations are far and JS implementations are close).
If you care about performance, eventually you'll probably want to use SIMD intrinsics for most of the array filling cases anyway (which will of course unfortunately be even harder to read than the currently fastest implementation), so adding a method specifically for the performance characteristics of that use case seems premature.I agree that memset/memcpy, while useful in other context, are useless to produce arbitrary data.Where I really disagree is that this (or an even worse mess) is the "best" that is attainable. That's simply not good enough. It is inconceivable to me how JS should fail at something that python, C, C++, lua, Java, haskell, erlang, brainfuck, D, go, and so forth all solve. Efficiently filling a binary array with data. This is a joke, it's a complete joke. You're seriously promoting a joke, as "best practice". I cannot condone this, that's baggering belief beyond my capacity to even wrap my mind around that idea. That's so broken, no words, just wow.