On 4 Dec 2008, at 02:58, Yon Uriarte wrote:

 thank you. I've keep working a bit on it. The airport ctor doesnt need to init the vector<xways>, it's wasteful.

Well, see my version in that regard.

Now it saves a few megabytes by removing unneeded parts from FGRunways (400k+ constructed) and using some string& instead of string copies.
By using those changes and also by using reduced precision on FGRunway members (double for length?) i was able to reduce sizeof(FGRunway)(win32) from 256 to 192.

I would prefer not to reduce precision - I don't think the memory savings warrant it, and at least on some machines, the compiler is forced to generate many float->double or double->float conversions. FGRunway is not efficient for size, but it's not costing us anything in real terms - unlike the start up time. And, again, I have pending work in this area that makes all of these issues go away completely, so unless there's an immediate benefit for the 1.99.x release, I would focus on some other area.

 One big contributor to size is SGAtomic. On windows it's 32 bytes for a 4 byte counter. That makes SGReferenced 32 bytes, too, for an 8 bytes payload.
After reading the docs on InterlockedIncrement (they say a 4 byte align is necessary) I tried recompiling with SGAtomic aligned on 4 bytes, but i got some quite obscure crashes inside ntsomething.dll called from malloc. Anyone knows why we need to align to 32 bytes (x86's cache line) and not 4 bytes as suggested by the docs?

Can't comment on that, I'm on GCC 4.0 on Mac where SGAtomic is falling-back to pthreads :( 

Here's my patch (including yours) to src/Airports:

Attachment: fg-apt-perf-james.patch
Description: Binary data


Regards,
James
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to