[Freeciv-Dev] (PR#9020) optimization of map_get_tile
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<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.
3. Change all users to use "pfmap" instead of "map".
4. Rename global "map" as "civ_map".
5. Rename global "map" as "game.map".
6. Remove global map entirely, have only local maps.
jason
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9020) optimization of map_get_tile,
Jason Short <=
|
|