logoalt Hacker News

saghmtoday at 7:36 AM1 replyview on HN

Much of a difference from which, the array of objects or an object containing arrays? The article points out at least one major optimization that the runtime performs on arrays that doesn't (and as I understand it, can't) exist for objects. My point is that it's not obvious whether there are others, and if so, where they might apply.

Pretty much the entire last paragraph of my comment that you responded to is an argument that it's potentially wrong to just naively assume "arrays are just objects". It's not clear to me why you're confident that this is wrong without giving any additional context that clarifies whether you've actually considered that possibility or not.


Replies

mr_toadtoday at 8:37 AM

I mean if you replaced an array of one million objects with an array of one million arrays you’d probably end up with similar performance.

The article is discussing how you get better performance from having arrays with one million primitives. It’s not at all surprising that this is faster.