>  http://caliban.lbl.gov/fgfs_patches/flightgear.diff

Great work. I wonder if there is a way to profile fg/sg for this kind
of inefficiencies somewhere in a tight loop.

A couple of comments:

diff -u -r1.43 AIBase.hxx
--- src/AIModel/AIBase.hxx      15 Oct 2005 14:55:51 -0000      1.43
+++ src/AIModel/AIBase.hxx      25 Oct 2005 06:59:49 -0000
@@ -108,7 +108,7 @@
     FGAIBase();
     virtual ~FGAIBase();
     virtual void update(double dt);
-    inline Point3D GetPos() { return(pos); }
+    inline const Point3D& GetPos() { return(pos); }

     enum object_type { otNull = 0, otAircraft, otShip, otCarrier, otBallistic,
                        otRocket, otStorm, otThermal, otStatic,


If you return the pos as a const Point3D&, you should
probably mark the method to be const as well on the same occasion.

Also, by doing this change you vouch that *every* CALLER of the method
doesn't use the reference beyond the scope of the object's life
(should be fine if all that's done is a copy ctor right at the caller)
-- ignore me if you have checked this already.

Same with other similar changes (returning a const reference) further in
the patch.

diff -u -r1.8 ATCdisplay.hxx
--- src/ATC/ATCdisplay.hxx      30 Sep 2004 15:43:32 -0000      1.8
+++ src/ATC/ATCdisplay.hxx      25 Oct 2005 06:59:56 -0000
@@ -76,16 +76,16 @@

     // Register a single message for display after a delay of delay
seconds
     // Will automatically stop displaying after a suitable interval.
-    void RegisterSingleMessage(string msg, double delay = 0.0);        // OK - 
I know passing a string in and out is probably not good but it will have to do 
for now.
+    void RegisterSingleMessage(const string& msg, double delay = 0.0); // OK - 
I know passing a string in and out is probably not good but it will have to do 
for now.

Here it looks like you can safely remove the comment now :)

>  http://caliban.lbl.gov/fgfs_patches/simgear.diff

This one looks to me as containing some additional local changes you've
made, beyond the const& optimization. See the chunks pertaining to

simgear/math/point3d.hxx
simgear/math/polar3d.hxx
and simgear/threads/SGThread.hxx

I suggest separating those away.

V.


_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to