| > Most common case is that this just wastes memory. Don't micro-optimizr before you know that this is actually a problem. You don't have many variables that fit the description I gave. You're already doing profiling if you can pick them out, and preemptively spacing them would barely take any memory, and it's the kind of problem that's hard to thoroughly test unless you have a 64 core machine sitting around. > If the operations that you commonly perform on the data structure, like inserting/deleting elements, then of course you should use a linked list For situations where linked list and array are both usable, then even if you very commonly insert and delete you're usually better off with a data structure that's built on top of fixed-size arrays. Iterating an array is so fast that it makes up for the cost of shifting around a surprisingly large number of elements. > or whatever container data structure your language provides. But which one? Languages tend to have a lot. And the ones that give you a one-size-fits-all data structure usually don't have a built-in linked list anyway. And I'm not suggesting anything notably fancy. |