[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] comparing typed arrays



On Wed, Jun 6, 2012 at 1:15 PM, Fabrice Robinet <cmg473@motorola.com> wrote:
Indeed, specifying a range for the compare and underneath relying on memcmp is *exactly* what I believe is missing.

FYI: APIs working on typed arrays never take a range; views are used to work on ranges. ÂThis avoids having to add and specify range parameters for every API that works with typed arrays. ÂIt's also much clearer with APIs like comparison, where you have two ranges.

On Wed, Jun 6, 2012 at 2:13 PM, Kenneth RussellÂ<kbr@google.com>Âwrote:
The intent in the typed array spec is minimality. Functionality is
only added when there are strong use cases.

Note that this doesn't necessarily have to be part of the typed arrays spec itself; secondary functionality can always be pushed to a separate spec, keeping the core spec minimal. Â(That spec can either supplement the ArrayBufferView interface, or create a new namespace.)

(I agree that use cases should always be there before adding any new APIs, of course. ÂI'm just noting that typed arrays don't need *stronger* use cases than other specs.)

They're prototyping them to see whether they yield a speedup. If they
do, that's strong motivation for adding them.

(I suppose this will boil down to whether modern JIT can detect that a loop is a memcmp(), and convert it to an optimized version, though this does feel like a core operation that might make sense to provide anyway, for unity of code if not performance.)

BTW, discussion of typed arrays is welcome on this list, but you might
consider emailingÂpublic-webapps@w3.orgÂfor a broader audience.

It's much the same audience, but whatwg@whatwg.org might be a little better. Â(WebApps is a chartered W3C WG with a set list of deliverables, and Typed Arrays isn't one of them.)

FWIW, I seem to recall this coming up on whatwg in the past, but I don't recall where.

--Â
Glenn Maynard