@mathias question: calling Array.apply(null,{length:10}) to create an array of fixed length will lose any of the element kinds optimizations?
-
-
Replying to @airnanan
The resulting array would have `PACKED_ELEMENTS` as its elements kind. Packed is better than holey!
1 reply 0 retweets 0 likes -
Replying to @mathias
and if later it's filled only with small integers? would it still be a PACKED_SMI_ELEMENTS?
1 reply 0 retweets 0 likes -
Replying to @airnanan
PACKED_SMI_ELEMENTS is more specific than PACKED_ELEMENTS. It’s not possible to transition upwards in the lattice
1 reply 0 retweets 0 likes -
Replying to @mathias
thanks for the info! last question: if I wanted to allocate a fixed sized array an keep it SMI, can I initiate it with a for loop pushing and int on every index?
1 reply 0 retweets 0 likes
Once you use new Array(n) the array is marked as HOLEY. `const array = []` + push is the way to go if you want to stick to PACKED_SMI_ELEMENTS
but it doesn’t pre-allocate.
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.