loading...

re: Javascript Array.push is 945x faster than Array.concat 🤯🤔 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: So from what I remember, Array implementations in V8 come in two flavours: Fast element and Dictionary element (hash table) arrays. The former is p...
 

While not shown in the use case (as the above oversimplifies the actual code). Your right that holes have an impact between the array mode / dictionary mode in V8 code. Having holes does not gurantee a trigger into dictionary mode, but is one of the contributing factor in how the internal engine decides the mode.

Probably worth further investigation, gut feel as of now from how I understand it, is the array in our use case would not have any holes 99% of the time. And from our internal code monitoring, its these 99% that's has the problem. >_<

I can't recall the talk reference for this (but definitely know it's real) so if you know where it's from. It would be good to add here for others to learn.

 

I replied to this, but I don't see the reply here. Really weird.

Anyways here are two resources that talk about how V8 handles arrays:

code of conduct - report abuse