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

reallocation/preallocation actually does increase manipulation and traversal performance.

The major slowness of linked lists is cache inconsistency. New nodes can be put all over the memory space. However, if you can make sure all or part of the list exists in contiguous blocks of memory, then there's a good chance that when the CPU loads up the next node it will also grab the next 3 nodes in a cache line.

The closer these node addresses are in memory, the faster things will be.




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

Search: