In this blog, I decided to talk about arrays and their behavior inside v8. By understanding these you can write efficient code that is good for v8 ...
For further actions, you may consider blocking this person and/or reporting abuse
Why does every "500 javascript one-liners" article get inundated with attention but stuff like this just barely makes it into my feed on the front page. I want more interesting stuff like this.
Look in the right place and follow the right people.
This content was available 7 years ago by Mathias Bynens.
Mathias Bynens (@mathias@mastodon.xyz) - Mastodon
3 Posts, 232 Following, 2.34K Followers · I work on @ChromeDevTools (ex-@v8js) at Google and on ECMAScript through TC39. ♥ JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.
Axel Rauschmayer
Axel Rauschmayer (@rauschma@fosstodon.org) - Fosstodon
4.14K Posts, 219 Following, 4.69K Followers · Topics: #JavaScript #TypeScript #fedi22 Other interests: – Languages: German, English, French, Spanish, Dutch, Mandarin – Sustainability, degrowth, permaculture, urbanism – Tiny houses – Education – Psychology, getting out of one’s head, heart-centered living – Minimalist spirituality: Advaita, Daoism, Buddhism, Christian mysticism, J. Krishnamurti, … I live in Munich. http://pronoun.is/he Non-tech: – :pixelfed: Photos: @rauschma@pixelfed.de – 💬 Languages: @langtales@mastodon.social
has covered holes since 2012:
If you are interested in this kind of thing: dig into why you may want to minimize megamorphic objects:
You might also want to check out old posts by one of the former V8 devs (nowadays a Dart dev) who developed some nice profiling tools: mrale.ph/
More importantly, how the hell was 2017 7 years ago that feels so wrong 😖
Thanks!
These articles are amazing. You can also follow the v8 engines' official blog at v8.dev
“Holey” is probably better written as “sparse,” which is the common technical term for this phenomenon.
Fascinating, thank you!
Wow. Great article I definitely don’t think a lot about the V8 side of things. Thanks for the great information.
Fascinating 🤓
Its a shame to only frame this in terms of performance. Unlike other languages, Javascript only has one collection type called 'associative arrays' which handle both the 'array' (contiguous list of items) and hash/dictionary/map of other languages. x[9] = 3 where x is [1,2,3] is not just slow, it should be impossible on your domain as its effectively changing the type from list to dict - so ideally designs should hide these things to prevent clients misusing them.
Great article!
Quick question - if I had an array of
int
s and I were to remove one of the items and replace it withundefined
, that would make it nowPACKED_DOUBLE_ELEMENTS
instead ofPACKED_SMI_ELEMENTS
?The reason I ask is because I see if you add
NaN
orInfinity
to aSMI_ELEMENTS
array it becomesDOUBLE_ELEMENTS
. Does v8 handleundefined
the same way?Crazy it only appeared me in 2024. Thanks for sharing, adding more and more knowledge everyday with these "kinds" (🤪) of articles!
mind-blowing paper. thank you.