[Freeciv-Dev] Re: chance of winning a battle
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Sun, 15 Jul 2001, Gaute B Strokkenes wrote:
>
> Has anyone done any profiling to make sure that this is the case, and
> if so would they like to share the results with the rest of us?
ok I did some profiling (not too much, couple of turns, took 2 cities or
so, 6 AI players, server and client on the same machine) and here are some
results:
the top of the pop is...
*applause*
normalize_map_pos from common/map.c with 10.84% of the votes
*big applause*
the reason being it's called lots of times and is not optimal,
attached is the patch that reduces the relative time to 4.54%
and, I think, makes the function a bit safer.
we can do a bit better, substituting "if" for "while" on 2 occasions but
it's unsafe (kind of assumes that we cannot go too far off the map).
patch is against CVS from 21 July
the function win_chance comes at 0.93% of the time which is quite high but
not crucial. problems might arise in the future, when more complicated AI
will call win_chance more often, when planning a whole campaign or
something.
while freely browsing the source I also discovered that dir_ok is
implemented in an ugly way. it's completely unneccessary to improve it
(with 0.00% of the usage) but might do it later all the same.
if anybody wants the profiling data file (for gprof), shout. It's mere
300K so I can send it anytime :)
G.
normalize_map_pos.diff
Description: Text document
- [Freeciv-Dev] Re: Patch correcting win_cnace, (continued)
- [Freeciv-Dev] Re: Patch correcting win_cnace, Gaute B Strokkenes, 2001/07/22
- [Freeciv-Dev] Re: Patch correcting win_cnace, Thue, 2001/07/22
- [Freeciv-Dev] Re: Patch correcting win_cnace, Gregory Berkolaiko, 2001/07/20
- [Freeciv-Dev] Re: Patch correcting win_cnace, Thue, 2001/07/20
- [Freeciv-Dev] Re: chance of winning a battle, Christian Knoke, 2001/07/15
- [Freeciv-Dev] Re: chance of winning a battle, Christian Knoke, 2001/07/15
- [Freeciv-Dev] Re: chance of winning a battle, Gaute B Strokkenes, 2001/07/15
- [Freeciv-Dev] Re: chance of winning a battle,
Gregory Berkolaiko <=
- [Freeciv-Dev] Re: chance of winning a battle, Gaute B Strokkenes, 2001/07/22
- [Freeciv-Dev] Re: chance of winning a battle, Trent Piepho, 2001/07/16
- [Freeciv-Dev] Re: chance of winning a battle, Gregory Berkolaiko, 2001/07/19
- [Freeciv-Dev] Re: chance of winning a battle, Thue, 2001/07/19
- [Freeciv-Dev] Re: chance of winning a battle, Erik Sigra, 2001/07/19
- [Freeciv-Dev] Re: chance of winning a battle, Trent Piepho, 2001/07/12
[Freeciv-Dev] Re: chance of winning a battle, Gregory Berkolaiko, 2001/07/12
[Freeciv-Dev] Re: chance of winning a battle, Daniel Speyer, 2001/07/12
|
|