Code: Select all
...
string mapFile = cb->GetMapName();
mapFile = "maps\\"+mapFile.substr(0,int(mapFile.size())-4)+".smd";
double mapTimer = clock();
int mapFileSize = cb->GetFileSize(mapFile.c_str());
*l<<"\n Code Timer 1: "<<(clock()-mapTimer)/CLOCKS_PER_SEC<<" seconds";
if( mapFileSize > 0 )
{
*l<<"\n Searching the Map File: '"<<mapFile<<"' File Size: "<<mapFileSize;
char *buffer = new char[mapFileSize];
mapTimer = clock();
cb->ReadFile(mapFile.c_str(),buffer,mapFileSize);
*l<<"\n Code Timer 2: "<<(clock()-mapTimer)/CLOCKS_PER_SEC<<" seconds";
...
Code: Select all
Code Timer 1: 3.02 seconds
Searching the Map File: 'maps\TheAbyss.smd' File Size: 4554
Code Timer 2: 2.98 seconds
Code: Select all
Code Timer 1: 6.47 seconds
Searching the Map File: 'maps\Total_Destruction.smd' File Size: 2518
Code Timer 2: 6.40 seconds
This problem seems to be due to the fact that some maps are formated in a way that all or a large number of the files within the archive are a part of the same 'block' and the callback functions simply re-extracts the file for each call. While opening these particular map archives with 7-zip I found that it really just takes some 3,7 seconds respectively to extract any of the map files within them. Does anyone know of a way that I could get around this problem?