Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] Re: (PR#9020) optimization of map_get_tile
Home

[Freeciv-Dev] Re: (PR#9020) optimization of map_get_tile

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9020) optimization of map_get_tile
From: "Per Inge Mathisen" <per@xxxxxxxxxxx>
Date: Fri, 18 Jun 2004 04:36:01 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9020 >

On Fri, 18 Jun 2004, Jason Short wrote:
> There have been discussions before about mass-inlining of functions.
> Arnstein made a patch for map.c, and Per wanted to inline some functions
> in city.c.
>
> My opinion is that changing functions to macro/inline should be done in
> a targeted way. Rather than do it in large batches, we should pick a
> function or two that is heavily used (based on profiling) and optimize
> it.(This applies to other forms of optimization, not just macro/inlining.)

I think we should distinguish here between making public functions
inline/macro, and making private static functions inline.

The former is problematic because it bloats up the headers and causes some
confusion as to where the function is actually implemented. So for this
case I support your proposition above.

However, the latter, turning plain static into static inline, I think a
little less hesitation should be applied.

Of course, some caution should still be applied, though, as inlining a
static function that is used in a lot of places can degrade performance
instead of improving it. So I think static inline should only be used when
the function is only called from a very few places, depending on the size
of the function.

  - Per




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