Curtis L. Olson writes:
> This can significantly increase load times ... which is a hassle if
> you are doing a lot of compile/run testing ...
I just wrote a short ANSI C++ test program to read the airport
database from the text file into an in-memory hash table. The basic
data structures look like this:
struct Runway
{
string name;
float lat;
float lon;
float len;
};
struct Airport
{
string id;
float lat;
float lon;
float alt;
vector<Runway> runways;
};
map<string,Airport> airports;
The entire program is available temporarily at
http://www.megginson.com/flightsim/airports.cxx
Here is the result of a run:
david@notebook:~/src/c++$ ./airports default.apt
Read 16937 airports in 1.11 seconds
On my notebook hard drive, times have ranged from 1.08 seconds to 1.13
seconds. The program makes heavy use of the C++ string, vector, and
istream classes, and could probably be made faster (by using char
arrays for strings, for example), but it hardly seems worthwhile.
Using a hash_map might speed things up as well.
I don't know how long it takes to initialize metakit and open a file
-- it's probably faster than this, but I don't know how much. Also, I
tested with the ungzipped default.apt.gz, which is 3.8MB, rather than
the gzipped one, which is just over 1MB; however, the metakit
runways.mk4 and simple.mk4 files add about 1.1MB together, so the
comparison is really 3.8MB without metakit vs. about 2.1MB with
metakit.
All the best,
David
--
David Megginson
[EMAIL PROTECTED]
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel