On Oct 25, 2007, at 12:11 PM, Ian Mallett wrote:
On 10/25/07, Casey Duncan <casey@xxxxxxxxxxx> wrote:On Oct 25, 2007, at 9:56 AM, Ian Mallett wrote: surface.get_at() can be kinda slow, and typically sequence item access is faster in python then a function call anyway. Regardless, I wouldn't worry about it unless it helps makes the code simpler or profiling shows you that using get_at() is slowing you down too much.It's slowing it down some, but the speed is fine. It's other people running my program that I'm worried about. My computer can do 256 squared calls to surface.get_at() in about 30 seconds, but it is pretty new.
yeah, it's always a good idea to have an old warhorse machine laying around to test on. Either that or a relative that never upgrades ;^)
Even with a fast machine where performance is acceptable, profiling can tell you if you are spending a disproportionate amount of time doing certain things. And if you have capped the framerate, you can experiment with inserting time.sleeps() in there to give away large amounts of time per frame to simulate a slower environment. If you don't cap the framerate, you can improve how smooth things are on your fast machine by refactoring the slow bits. 50-60fps looks a lot more polished than 30fps for instance, but it really depends on the game and how much things are moving frame to frame.
-Casey