On Tue, Oct 7, 2014 at 12:22 PM, Rick Waldron <[email protected]> wrote:
> > > On Tue, Oct 7, 2014 at 3:01 PM, Dmitry Soshnikov < > [email protected]> wrote: > >> On Tue, Oct 7, 2014 at 11:59 AM, Dmitry Soshnikov < >> [email protected]> wrote: >> >>> On Tue, Oct 7, 2014 at 11:56 AM, Claude Pache <[email protected]> >>> wrote: >>> >>> >>>> >>>> >>>> > Le 7 oct. 2014 à 20:36, Dmitry Soshnikov <[email protected]> >>>> a écrit : >>>> > >>>> > And other things are better be written: >>>> > >>>> > ``` >>>> > <ArrayKind>.from(iterable).map(mapfn) >>>> > ``` >>>> > >>>> > Am I still missing something? >>>> >>>> Yes: `UInt32Array.from(['a', 'b', 'c], x => x.codePointAt(0))` >>>> >>>> >>> Still seems the same as `NodeList` "issue": >>> >>> ``` >>> UInt32Array.from(['a', 'b', 'c].map(x => x.codePointAt(0))); >>> ``` >>> >> >> And after you have fed the data the `UInt32Array` expects, you can >> post-map it as well: >> >> >> ``` >> UInt32Array.from(['a', 'b', 'c].map(x => x.codePointAt(0))).map(v => v * >> 2); >> ``` >> >> What's is wrong in here? >> > > That example will allocate 2 additional objects; the following version of > the same operation will allocate _zero_ additional objects: > > UInt32Array.from(['a', 'b', 'c], x => x.codePointAt(0) * 2); > > Exactly. And this is what I mentioned at the beginning: the performance reasons shouldn't (never) overweight in "good API design" topics. Dmitry
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

