Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: inlining functions
Home

[Freeciv-Dev] Re: inlining functions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Kevin Brown <kevin@xxxxxxxxxxxxxx>
Cc: Jason Dorje Short <jshort@xxxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: inlining functions
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 19 Aug 2001 16:09:06 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Aug 17, 2001 at 09:41:32PM -0700, Kevin Brown wrote:
> Jason Dorje Short <jshort@xxxxxxxxxxxxx> wrote:
> > Tony Stuckey points out that "GCC doesn't do cross-procedural
> > optimization, nor cross-source-file inlining of small functions", and so
> > macros are better [1].  Again, I think this is a compiler issue.
> 
> Even if this is an issue, cross-source-file inlining is resolved by
> doing
> 
>       static inline type name(args) {
>           ...
>       }
> 
> in the header files.

Which in my opinion are ugly.

> For the cases where we're concerned about cross-procedural
> optimization (or lack thereof), it makes sense to test the inlined
> function version against the macro version to see how much of a
> difference it'll really make.
> 
> > Finally, I read about a GCC option, "-finline-functions", that will
> > cause small functions to be inlined automatically.
> 
> Now *THAT* is cool.  Anyone want to do some profiling to test this
> option's effectiveness on the Freeciv source?  :-)

See also (from "info gcc"):
`-O3'
     Optimize yet more.  `-O3' turns on all optimizations specified by
     `-O2' and also turns on the `inline-functions' option.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  The trick is to keep breathing.


[Prev in Thread] Current Thread [Next in Thread]