[SDL] Submission: IMG_Init and IMG_Quit for faster loading
donny.viszneki at gmail.com
Mon Apr 6 18:38:20 PDT 2009
On Mon, Apr 6, 2009 at 2:59 PM, Mason Wheeler <masonwheeler at yahoo.com> wrote:
> I was looking through the event log of one of my programs that does a lot of image loading, and saw several hundred repeats of the notification that libpng.dll and zlib.dll had been loaded and then unloaded. A bit of checking around in IMG_png.c confirmed my suspicions: It was loading and unloading libpng (which had its own dependency on zlib) for every single image. There was code built into IMG_InitPng() to prevent this, but it never actually gets used. So I wrote up a quick patch to enable it, adding IMG_Init() and IMG_Quit() routines that work a lot like SDL_Init() and SDL_Quit().
Wow, great catch! Thanks for your contribution!
> The results were dramatic. Not unloading and reloading the DLLs every time shaved about 43 seconds off of a loop that processed 357 PNG images! (On a nice, fast quad-core system with 4 GB of RAM!) Apparently there's some pretty significant overhead associated with those loads and unloads. This will really boost performance for anyone who needs to load up a bunch of images.
This is a really bad frame of reference! How long does it take without
More information about the SDL