Vivian Meazza wrote: > Only a minute eh? Under Cygwin cvs takes nearly 5 minutes - time for > a brew a coffee - and that's on a pretty powerful machine.
Time from execution to fade in of the cockpit display is about 10 seconds on my laptop (1.8GHz Athlon64). I started trying to hunt this down. One issue that had been discovered earlier is that an AI-related patch to the the airport loading code in February causes the startup routine to try to load a rwyuse.xml and parking.xml file in every one of 24597 potential directories under $FG_ROOT/Aiports/AI. Attached is a patch that pre-reads the directory contents ahead of time (currently that is a list of length zero) to avoid having to hit the kernel (twice!) for every airport. Under Linux, this doesn't provide much speedup. But Windows (and especially the cygwin libraries) has a somewhat less robust I/O system in the face of many tiny operations. Hopefully it will help there. Can someone on each of cygwin, mingw and/or MSVC try this out and see if it helps? Unfortunately, because there is no actual parking/runway AI data in the base package, much of this is currently "dead code" that cannot be tested. I can't promise I didn't break anything, because I have no way of knowing whether it worked in the first place. :) Andy
Index: src/Airports/simple.hxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Airports/simple.hxx,v retrieving revision 1.12 diff -u -r1.12 simple.hxx --- src/Airports/simple.hxx 10 Feb 2005 09:01:51 -0000 1.12 +++ src/Airports/simple.hxx 26 May 2005 20:47:33 -0000 @@ -42,10 +42,12 @@ #include STL_STRING #include <map> +#include <set> #include <vector> SG_USING_STD(string); SG_USING_STD(map); +SG_USING_STD(set); SG_USING_STD(vector); typedef vector<string> stringVec; @@ -306,11 +308,12 @@ airport_map airports_by_id; airport_list airports_array; + set < string > ai_dirs; public: // Constructor (new) - FGAirportList() {} + FGAirportList(); // Destructor ~FGAirportList(); Index: src/Airports/simple.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Airports/simple.cxx,v retrieving revision 1.17 diff -u -r1.17 simple.cxx --- src/Airports/simple.cxx 25 Feb 2005 19:41:53 -0000 1.17 +++ src/Airports/simple.cxx 26 May 2005 20:47:33 -0000 @@ -1149,6 +1149,26 @@ * FGAirportList *****************************************************************************/ +// Populates a list of subdirectories of $FG_ROOT/Airports/AI so that +// the add() method doesn't have to try opening 2 XML files in each of +// thousands of non-existent directories. FIXME: should probably add +// code to free this list after parsing of apt.dat is finished; +// non-issue at the moment, however, as there are no AI subdirectories +// in the base package. +FGAirportList::FGAirportList() +{ + ulDir* d; + ulDirEnt* dent; + SGPath aid( globals->get_fg_root() ); + aid.append( "/Airports/AI" ); + if((d = ulOpenDir(aid.c_str())) == NULL) + return; + while((dent = ulReadDir(d)) != NULL) { + cerr << "Dent: " << dent->d_name; // DEBUG + ai_dirs.insert(dent->d_name); + } + ulCloseDir(d); +} // add an entry to the list void FGAirportList::add( const string id, const double longitude, @@ -1172,7 +1192,8 @@ rwyPrefPath.append( "/Airports/AI/" ); rwyPrefPath.append(id); rwyPrefPath.append("rwyuse.xml"); - if (parkpath.exists()) + if (ai_dirs.find(parkpath.str()) != ai_dirs.end() + && parkpath.exists()) { try { readXML(parkpath.str(),a); @@ -1181,7 +1202,8 @@ //cerr << "unable to read " << parkpath.str() << endl; } } - if (rwyPrefPath.exists()) + if (ai_dirs.find(rwyPrefPath.str()) != ai_dirs.end() + && rwyPrefPath.exists()) { try { readXML(rwyPrefPath.str(), rwyPrefs);
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@flightgear.org http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d