Vivian Meazza wrote:
> The results of this patch are very encouraging:
> Airports and Navigation Data Total
> Before 2 min 40 sec 3 min 50 sec
> After 1 min 40 sec 2 min 50 sec
> It's still the most significant part of the load process - can we be even
> more clever yet?
Wow... my (decidedly mid-range) system is literally 17x faster than
that. Can you provide more detail? How much memory do you have on
the box? (i.e. are you running out of buffer cache and hitting the
hardware -- my 10 second number is with a primed cache on a 1GB
If hardware I/O is the bottleneck, are you using FAT? If so, how long
has it been since you defragged your drive? (Or for that matter: used
a spyware checker recently? etc...)
The apt.dat.gz file is big, certainly. It has 165976 lines, only
91813 of which are actually used by the parser*.
* So in principle you can get another 2x speedup by pruning the file
from the raw X-Plane version. Attached is a little perl script that
does that. Untested. Use it as someting like:
zcat apt.dat.gz | fgapt.pl > apt.dat
Whether this is worth using a modified file is questionable.
Again, on my machine it would save about 2 seconds. Shrug.
The problem is that this file parses acceptably fast on my box (about
4 seconds), so it isn't CPU speed that's the problem. I even wrote a
quickie hand-optimized parser in C to see if the STL in the existing
one was causing slowness and it's not (my parser gets through the file
in about 2 seconds, but doesn't do anything with the data). And I/O
from the file it is handled by zlib, which should be reading large
chunks at a time; on linux, it reads chunks of 16k, which shouldn't be
slow even on windows. That comes out to about 210 reads over 100
seconds as per your numbers above, and if your cygwin is really taking
half a second (!) per 16k read, then something is badly wrong way
beyond what FlightGear can fix.
I have to believe there is something at work here beyond mere
windows/cygwin slowness. I do have a windows machine handy, however,
so I'll try to do a cygwin build today and see how it works. I notice
that cygwin *does* have a "strace" equivalent. If you get a chance,
strace -t fgfs > really-huge-log-file.txt
(Apply the plib patch before doing this, as it will reduce the syscall
count and make the resulting file smaller).
This will slow things down even more, but should give you some idea of
where FlightGear is spending its time. Search down to where you see
it open apt.dat.gz and watch the reads and how long they take.
Flightgear-devel mailing list