Ok, coding suggestions ... think very carefully about your algorithms. The obvious way isn't always the best way.
Example: I want to add items to a list, and remove the lowest value. Both operations will be done regularly.
Ok, one way is to sort the list.
What kind of sort should I use? Is quicksort *always* faster than bubble sort? The answer is no. If you have an already sorted list and want to insert a new value, a bubble sort from the back of the list towards the front will always be faster than quicksort.
But this means that every time I add an item, I have to shift on average half the list each time to get the item positioned correctly. When I delete an item, I have to shift the whole list. In fact, under certain circumstances, it may be worse than that (if I'm continually adding items that are lower on average than the rest of the list).
Do I really want a sorted list? Well, no. That's just one way to keep the item I want next easy to find. What other things can I do?
Ok, I could keep the data in a binary tree arrangement, but I don't really want the overhead needed to keep the tree balanced and in sequence, and I really don't want to keep track of deleted entries. Let's look for something lighter still...
What I could settle on in the end is a heap arrangement. It has the properties of keeping the lowest or highest value first (although other items are not easy to locate), automatically balancing itself (so one side is never more than one level deeper than the other), automatically fills the gap when the first item is removed, and it's actually fairly easy to understand and code. More importantly, it matches my requirements exactly.
... You'll find this example right at the centre of the A* pathfinder code I've posted in Codebase, and a stripped down heap example there also with a link to a site with an explanation
So think smart, and make sure that your code does as much as it needs to do ... but no more.