Friday, April 20, 2007

Ten Times Faster

Just made a nice tidy up in my text rendering code. Previously I had this:

while(!Chunks.empty())
{
GDITextChunk* pchunk = Chunks.front();
DrawChunk(pchunk);
Chunks.remove(pchunk);
delete pchunk;
}

Now I have this:

std::list::iterator it;
for(it = Chunks.begin(); it != Chunks.end(); ++it)
{
GDITextChunk* pchunk = *it;
DrawChunk(pchunk);
delete pchunk;
}

And its TEN times faster that way. woohoo. I probably changed the way chunks were rendered at some point, and never thought to re-evaluate that part of the code. I might see if I can get away with the chunks being in a vector instead, that might be even faster.
Rock Legend is going well, done some serious play balancing, and now I have the gig art in, so its a case of having a quick look at performance optimising. That's the trouble with developing on a dual core machine with an 8800 GTS, you have no idea if normal amchines can run the thing ok.