Quick answer: Pygame.image.load taking 800ms on first call but instant after? SDL_image lazy-initializes its decoder backends - preload by decoding a 1px PNG at init.
Game window opens but the first sprite load freezes for almost a second. Subsequent loads are sub-millisecond.
Warm up the decoder
pygame.image.load(io.BytesIO(b"\x89PNG..."))One trivial decode at init triggers SDL_image's backend init. Subsequent loads skip the path.
Preload all sprites
For small games, load every sprite during a splash screen. The user sees the splash; they don't see the load spike.
Use convert() at load time
img.convert() after load amortizes the format conversion. Helps frame-rate on the first blit.
“Lazy initialization is great for startup, bad for first-frame consistency.”
Time your splash screen to exceed the warm-up duration. Even 100ms feels slow when followed by a freeze.