I’ll never new Array(length) again. Holy holey @mathias , although the fact typed Arrays want length upfront can be confusing! #NodeConfAr17
-
-
-
Andrea Giammarchi Retweeted Mathias Bynens
Andrea Giammarchi added,
1 reply 0 retweets 1 like -
Replying to @WebReflection @bdc
Just to be clear: `new Array(n)` still has its uses! As always, It Depends™. Here’s some more info.
#NodeConfAr17pic.twitter.com/hMnDiJoXj6
2 replies 1 retweet 4 likes -
Replying to @mathias @WebReflection
I like using this pattern to create x objects: Array(10).fill(0).map(…) I assume the perf hit doesn’t really apply here since I map it?
1 reply 0 retweets 1 like
Replying to @bdc @WebReflection
Indeed — it creates a holey array but `map` creates a new one that is packed.
Btw, `new Array(n)` is faster than `Array(10)` in @v8js.
8:40 AM - 27 Oct 2017
1 reply
0 retweets
3 likes
-
-
Good to know, thanks!
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
