Don't always flip()Something bugged me today. Although our game runs at a fast 60fps, it still was using about 60% of CPU on my weak eeepc. For a game mainly only active on events this is pretty bad. To solve this issue I decided to get rid of the display.flip() and use pygames.update() instead only updating parts of the screen that are more commonly used. By doing this our CPU usage was reduced to 2/3rds. More optimization to come.
In case you are not writing a scrolling game: pygame.display.update() might save your framerates.
(log in to comment)
mihi on 2011/09/16 11:40:More performance hacks: since we have an event based game, we don't need to redraw the sceen if there are no events. This brings cpy load down to 9% on idle and 20% if there are events. I'm moar happy now.