A lot of game developers consider the start-up time of a game to be of little importance. Unfortunately, the truth is that users do not like looking at the hourglass. So, here are two tips to reduce start-up time.
1. Use Targa instead of PNG
PNGs take several times longer to decode than compressed Targa. I think it’s around 5 times slower. (I once made some measurements on the iPhone, but I lost the figures <duh>). On the other hand, compressed Targa files are about 40% bigger, but disk space usually isn't that critical. You can use the code here to decode targa files: http://dmr.ath.cx/gfx/targa/.
An interesting side effect of this optimization is that it also reduces development time. Every time you start up the debugger, it has to decode all those 1024×1024 textures, before you can begin.
2. Read Files by Blocks, Not Word by Word
Preferably, read the whole file in one go. This is how you do it with C code:
FILE* pFile;
pFile = fopen(fileName.c_str(), "rb");
if (pFile == NULL) return;
fseek(pFile, 0, 2 );
fileSize = (int)ftell(pFile);
fseek(pFile, 0, 0 );
pBuffer = new char[filesize];
int bytesRead = (int)fread(pBuffer, fileSize, 1, pFile);
fclose(pFile);
