libretro / snes9x2002

Snes9x 2002. Port of SNES9x 1.39 for libretro (was previously called PocketSNES). Heavily optimized for ARM.
37 stars 46 forks source link

Improve save state efficiency #53

Closed jdgleaver closed 2 years ago

jdgleaver commented 2 years ago

At present, every time that retro_serialize_size() is called (i.e whenever save states are used), the core determines the save state size by allocating a temporary 5 MB (yes, 5 megabytes...) buffer and writing into this an actual save state. For a core that is focussed solely on performance, this is somewhat absurd... (on memory starved platforms, the temporary buffer allocation may even fail...)

With this PR, the save state size is now calculated independently of regular save state creation. No temporary buffer is required, and there is no need to actually write a save state to memory.