On 26 Sep 2010, at 22:09, ThorstenB wrote:

> Hi,
> there is a forum topic discussing compiler optimization to improve
> frame rate ( http://www.flightgear.org/forums/viewtopic.php?f=45&p=96830
> ).
> I have also tried this (and successfully improved mine... :-) ).
> 
> However, I also compiled with "-Wall" and this shows several issues
> with the FlightGear sources. Simgear is really clean though (no
> warnings with g++ 4.4, *clapclap*).
> 
> I'm seeing 55 warnings with FlightGear: mainly (potential) usage of
> uninitialized variables and violations of strict aliasing. The latter
> easily results in broken code when optimizing with "-O2" or above (oh
> no, "-O2" is the FlightGear default!). Well, and there is another 54
> warnings in the AI module, but only since the member variables aren't
> initialized in the sequence of their declaration (very easily fixed).

In general, fixing warnings and switching on -Wall would get my vote; various 
people have done work on this over the past few years - Torsten Dryer and 
myself recently, but several others too. I'm not sure we can achieve the 
equivalent for all compilers, but requiring -Wall and possibly -Werror 
(optionally!) for GCC 4.4 would be nice. Patches welcome :)

Regarding the compile flags, I'd prefer to use the default system CXXFLAGS by 
default, but provide a --aggressive or --optimised configure option that does 
this. 

Apple strongly recommend -Os over -O2 or -O3, as the default for production 
code, with -O2 or -O3 enabled on a file-by-file or module-by-module basis. This 
is really Apple saying they think i-cache coherency is a bigger win than 
massive loop unrolling, inlining and the like. They also recommend using 
profiling to identify the actual hot functions, since I'd guess the hot 
functions in the FlightGear frame loop are in OSG, not FlightGear itself. Even 
the FDMs aren't that hot, comparatively.

If anyone could compare -Os with -O3 (with march=native and SSE enabled), and 
post the frame-rate difference, I'd be interested. (The comments above do date 
from the PPC days, some of which were i-cache starved)

The SSE math flags are a no-brainer where supported - the -march-native and 
-sse flags are all Apple defaults in Xcode.

James


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to