Yet another attempt at typed JS data

Andrea Giammarchi andrea.giammarchi at gmail.com
Mon Feb 10 20:25:39 UTC 2020


Great, now maybe you also read how it works behind the scene, and debug
properly to understand that every array is holey, including the latter one,
to date.

https://v8.dev/blog/elements-kinds

Please, let's assume for a second I knew what I was talking about, when
I've said it's a mess to not have holey arrays, thanks.

On Mon, Feb 10, 2020 at 9:21 PM Michael Haufe <tno at thenewobjective.com>
wrote:

> Array(3)
> //  [empty × 3]
>
> Array(3).fill()
> // [undefined, undefined, undefined]
>
> Array(3).fill('whatever')
> // ["whatever", "whatever", "whatever"]
>
>
> -----Original Message-----
> From: es-discuss <es-discuss-bounces at mozilla.org> On Behalf Of Bergi
> Sent: Monday, February 10, 2020 1:27 PM
> To: es-discuss at mozilla.org
> Subject: Re: Yet another attempt at typed JS data
>
> Hello!
>
> > Unfortunately, `Array.from({ length: 4 }, () => whatever)` produces a
> > holey array
>
> Does it? But really, if the performance difference betweeen HOLEY and
> PACKED arrays were large enough to be relevant[1], the engine programmers
> would certainly already have optimised all those trivial cases where an
> array is filled gradually to produce the more efficient representation.
>
> kind regards,
>  Bergi
>
> [1]: it probably isn't:
> https://stackoverflow.com/questions/54481918/#comment95848513_54485509
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20200210/85e03d03/attachment-0001.html>


More information about the es-discuss mailing list