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: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Fri, 18 Jun 2004 09:01:00 -0700
Reply-to: rt@xxxxxxxxxxx

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

On Fri, 18 Jun 2004, Jason Short wrote:

> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9020 >
>
> 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.)
>
> According to a profile I made (which I'll attach as a comment)
> map_get_tile accounts for 4% or more of server execution time.  Turning
> it into a macro speeds up the server by just over 5%.  However turning
> it into a map is tricky because this "function" accesses the global map
> variable, which conflicts with about 10 of its users that already have
> local map variables.
>
> There are several ways around this.  Here's a list, in order of
> increasing difficulty (and approximately in order of decreasing
> goodness).  I don't particularly care which we pick.
>
> 1.  Don't bother to change the code at all.
>
> 2.  Use inline instead of macro.

What is the performance gain with inline?

>
> 3.  Change all users to use "pfmap" instead of "map".

Is it a hint that the offenders are PF and friends?  I have no problem
about renaming pfmap, in fact, we should do it anyway.

> 4.  Rename global "map" as "civ_map".
>
> 5.  Rename global "map" as "game.map".

Should be done as well.

G.




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