Improving Display Performance

Viewed 133

So I've been tacking on some things to my game and after adding a particular thing the game got pretty laggy. I did some tests using pygame.time.get_ticks() to see where the time was being spent in my loop, and found about 90% of time was spent in two locations. 1. Drawing all my sprites to the screen. 2. Drawing my ability manager, which is just drawing/blitting some images.

I got confused when removing my convert() and convert_alpha() significantly improved performance in my ability manager, and then removing the converts in drawing my sprites did not seem to affect performance.

Anyone have any idea why convert might slow things down, the docs say its the best way to go. Also, why might it help in one area and not another?

Edit: Some numbers to show my tests. Removing converts for #2, the ability manager drawing, decreased the average time to draw them from roughly 80 milliseconds to roughly 45 milliseconds. Removing or adding converts for #1, drawing sprites to screen, hardly affects the time to do things. The affect ranges from + or - 5. This small change may not be the result of removing converts, so my question should mainly focus on "Why does removing convert help so much in the ability manager drawing?", and only a little on why it might help so much in one area and not another.

1 Answers
Related