pygame’s API for initializing a display has a couple attractive sounding flags. Or at least, they sound attractive once you notice that updating your 320x240 window at 30fps is consuming all available cycles on your brand new Intel i9 CPU. They’re
DOUBLEBUF. Hardware surfaces and double buffering is how you make graphics fast, right?
Well… no. You probably can’t get a hardware surface anyway, and double buffering is unlikely to help until you figure out how to have a window larger than 320x240 anyway.
What you really need to do to get reasonable rendering performance is make sure that any images you blit to the display have the same color depth. You can do this with the
Surface.convert method (you get back a Surface when you load an image from a file, eg a png or a gif). Check the depth of your display surface and then convert your image surfaces to that depth (and just keep the converted versions). Blitting them will get hundreds of times faster.
It’s a pretty simple thing, but it’s easy to get distracted by
HWSURFACE and not notice the depth mismatch (like I did for three days).