Hacker News new | past | comments | ask | show | jobs | submit login

>I really don't see why you wouldn't expect to find cache-sensitivity in Python, or in some other similarly high-level language... Python lists are sequences and thus must support random access. In practice that means the implementation is a (dynamically resizing) array allocated contiguously.

The contents of the dynamically allocated array, in the C implementation, are pointers (PyObject), since the lists are heterogeneous and must be able to store any Python object. That entails indirection, which defeats spatial locality. Even if you iterate over cached data, you have to jump around to retrieve the actual objects to do anything* with them.




Sure. But that's one less level of indirection than if you also had to jump around to get the reference to the object in the first place.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: