typed array filling convenience AND performance

2014-10-30 Thread Florian Bösch
The usecases: *1) Filling with custom data* When writing WebGL or physics or many other things todo with large collections of data, it's not unusual to have to fill arrays with custom data of some kind. someArray.set([ x0, y0, 1, 0, 0, x1, y0, 0, 1, 0, x1, y1, 0, 0, 1, x0, y0, 1, 0, 0,

Re: Proposal: Abstract References

2014-10-30 Thread Andreas Rossberg
On 29 October 2014 21:59, Mark S. Miller erig...@google.com wrote: On Wed, Oct 29, 2014 at 8:16 AM, Andreas Rossberg rossb...@google.com wrote: On 27 October 2014 16:50, Tom Van Cutsem tomvc...@gmail.com wrote: 2014-10-27 15:00 GMT+01:00 Andreas Rossberg rossb...@google.com: but without

Re: typed array filling convenience AND performance

2014-10-30 Thread Jussi Kalliokoski
+1 - especially the lack of something like the proposed memset() has been a massive headache for me. Semantics (I'm quite nitpicky on them)... I'd prefer the argument order for memcpy() to be (src, dstOffset, srcOffset, size) to be consistent with set(). As for memset(), I'd prefer (value,

Re: typed array filling convenience AND performance

2014-10-30 Thread Allen Wirfs-Brock
Have you looked at the ES6 typed array constructor http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarray%-intrinsic-object and instance methods http://people.mozilla.org/~jorendorff/es6-draft.html#sec-properties-of-the-%typedarrayprototype%-object In

Re: typed array filling convenience AND performance

2014-10-30 Thread Jussi Kalliokoski
On Thu, Oct 30, 2014 at 3:14 PM, Adrian Perez de Castro ape...@igalia.com wrote: On Thu, 30 Oct 2014 09:29:36 +0100, Florian Bösch pya...@gmail.com wrote: The usecases: [...] *3) Initializing an existing array with a repeated numerical value* For audio processing, physics and a

Re: typed array filling convenience AND performance

2014-10-30 Thread Florian Bösch
On Thu, Oct 30, 2014 at 1:41 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: Performance optimizatiuon in an implementation issues. That’s where you should apply performance pressure. That's true, but if there's only bad APIs to do certain tasks, it doesn't help.

Re: typed array filling convenience AND performance

2014-10-30 Thread Steve Fink
On 10/30/2014 06:14 AM, Adrian Perez de Castro wrote: On Thu, 30 Oct 2014 09:29:36 +0100, Florian Bösch pya...@gmail.com 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

Re: typed array filling convenience AND performance

2014-10-30 Thread Filip Pizlo
On Oct 30, 2014, at 10:44 AM, Steve Fink sph...@gmail.com wrote: On 10/30/2014 06:14 AM, Adrian Perez de Castro wrote: On Thu, 30 Oct 2014 09:29:36 +0100, Florian Bösch pya...@gmail.com wrote: The usecases: [...] *3) Initializing an existing array with a repeated numerical value*

Re: typed array filling convenience AND performance

2014-10-30 Thread Florian Bösch
On Thu, Oct 30, 2014 at 6:44 PM, Steve Fink sph...@gmail.com wrote: Now there is %TypedArray%.prototype.fill. But I've become generally skeptical about it as an answer to performance concerns. I would rather see engines hyperoptimize for(var i=0; isize; i++){ someArray[i] = 0; } based on

Types

2014-10-30 Thread Zexx
Hello, Isn't optional typing (similar to TypeScript) a good thing? Let's say I want to do some image processing. And images can be really huge nowadays. If I allocate an array of dynamic variables, that array may be 10x larger than if it was an array of bytes. And I need bytes to store and

RE: Types

2014-10-30 Thread Domenic Denicola
Use typed arrays. From: Zexxmailto:zex2...@gmail.com Sent: ‎2014-‎10-‎30 20:16 To: es-discuss@mozilla.orgmailto:es-discuss@mozilla.org Subject: Types Hello, Isn't optional typing (similar to TypeScript) a good thing? Let's say I want to do some image processing.

Re: Types

2014-10-30 Thread Allen Wirfs-Brock
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-typedarray-objects On Oct 30, 2014, at 9:27 PM, Domenic Denicola d...@domenic.me wrote: Use typed arrays. ___ es-discuss mailing list es-discuss@mozilla.org

Re: Types

2014-10-30 Thread Axel Rauschmayer
TypeScript is about static type checking (and IDE support), what you want dynamic types that are better fits for problem domains. This is a step in that direction (in addition to typed arrays in ES6): https://github.com/dslomov-chromium/typed-objects-es7