@smashingconf question for @mathias:
const arr = [];
let i = length;
while (i--) arr[i] = whatever;
Does are therefore become a holy array and deopt?
-
Show this thread
-
Also, what about new Array(20).fill(0)? Packed or holy?
4 replies 0 retweets 2 likesShow this thread -
Replying to @jaffathecake
Both arr.length = n and new Array(n).fill(0) (for n > 0) create holey arrays. No way to transition upwards in the lattice, even with Array#fill
(We could change this in @v8js, but it would be a massive undertaking that’s likely not worth the performance benefits.)4 replies 0 retweets 5 likes -
Array.from({ length: n }, (_, i) => i) Holey? It’s my goto ‘range’ method
1 reply 0 retweets 0 likes
Yes, that array would be marked as holey. See https://mths.be/v8ek .
12:33 PM - 8 Feb 2018
0 replies
0 retweets
0 likes
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.