The thing is I'm only checking the one entity. However, the way it's written now, since most of the information is stored in a 2d array, I'm technically stepping through each place in the array, checking to see if it is occupied and, if it is, seeing if what's in that particular spot has anything it needs to do.
So, right now, it has to go through each of n spaces each of x times between each turn.
Having a list of units that actually need to do something would definitely help performance, and iterating through the map only once to fill it seems like a much better plan. And Jester's example still seems better than the plan I came up with last night.
My current plan is a priority queue setup where it will pop the highest priority "turn" that needs to occur next, then subtract that priority from the rest, then push in the next "turn" for that entity that would occur a certain time away. A quick visual example of this:
Queue Contents: 2(a), 5(b), 6(c)
queue.pop() - Queue Contents: 5(b), 6(c) -> 3(b), 4(c)
queue.push(a, 2) - Queue Contents: 2(a), 3(b), 4(c)
queue.pop() - Queue Contents: 3(b), 4(c) -> 1(b), 2(c)
queue.push(a, 2) - Queue Contents: 1(b), 2(c), 2(a)
queue.pop() - Queue contents: 2(c), 2(a) -> 1(c), 1(a)
queue.push(b, 5) - Queue contents: 1(c), 1(a), 5(b)
I'll probably get to trying to implement this once I'm actually awake, then see how useful it is to me compared to Jester's much simpler code.