Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2001:
[Freeciv-Dev] Re: map_adjust_x()
Home

[Freeciv-Dev] Re: map_adjust_x()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Thue <thue@xxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: map_adjust_x()
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: 17 Mar 2001 04:04:29 +0000

On Wed, 14 Mar 2001, thue@xxxxxxx wrote:

> Gaute B Strokkenes said he was going to go through and make lots of
> stuff inline, benchmarking as he goes.

Yes.  Unfortunately, I didn't manage to get all the things that I
wanted to do done before term started, so nothing came of it until
now.  Full term ended today, so I finally have some time to look at
this again (see http://www.cam.ac.uk/CambUniv/TermDates.html).

I have repeated the experiments that I did earlier, see:

http://arch.freeciv.org/freeciv-dev-200101/msg00063.html

except that I'm now playing with a much faster machine.  I compiled
Freeciv with ./configure --disable-nls --disable-client and make
CFLAGS="-O2 -pg" and got the following result (abbreviated):

real    6m33.805s
user    5m40.570s
sys     0m0.860s

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 10.73     15.94    15.94 46137162     0.00     0.00  map_get_city
 10.01     30.82    14.88     4891     3.04     5.69  really_generate_warmap
  9.89     45.52    14.70 67597497     0.00     0.00  map_get_tile
  7.15     56.15    10.63 35113931     0.00     0.00  map_get_terrain
  5.96     65.00     8.85     1154     7.67    50.09  ai_manage_explorer
  3.35     69.98     4.98 23593606     0.00     0.00  map_get_known
  3.22     74.76     4.78  1504331     0.00     0.01  invasion_funct
  3.15     79.44     4.68 41700583     0.00     0.00  normalize_map_pos
  3.11     84.06     4.62  2884741     0.00     0.01  is_my_zoc
  2.74     88.13     4.07 19526077     0.00     0.00  find_genlist_position
  2.30     91.54     3.41 12492690     0.00     0.00  is_non_allied_unit_tile
  1.99     94.50     2.96     2041     1.45    22.22  find_something_to_kill
  1.90     97.33     2.83 19525956     0.00     0.00  genlist_iterator_init
  1.57     99.67     2.34  4777403     0.00     0.00  get_from_mapqueue
  1.14    101.37     1.70  9076676     0.00     0.00  is_ground_unit

...

  0.00    148.58     0.00        1     0.00     1.20  wipe_unit

I prettified my earlier efforts, and came up with fast_map3.diff which
inlined several of the map_get_foo() functions and normalize_map_pos()
and got the following results:

real    4m44.354s
user    4m22.310s
sys     0m0.830s

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 11.07     14.94    14.94     4891     3.05     4.28  really_generate_warmap
 10.54     29.17    14.23  1504331     0.01     0.01  invasion_funct
  8.23     40.28    11.11     1154     9.63    49.24  ai_manage_explorer
  7.29     50.12     9.84  2884741     0.00     0.01  is_my_zoc
  6.71     59.18     9.06 12492702     0.00     0.00  is_non_allied_unit_tile
  5.91     67.16     7.98 19529554     0.00     0.00  find_genlist_position
  5.11     74.05     6.89 23594770     0.00     0.00  map_get_known
  3.92     79.34     5.29 19529433     0.00     0.00  genlist_iterator_init
  2.21     82.32     2.98     2041     1.46    17.92  find_something_to_kill
  1.67     84.58     2.26   229328     0.01     0.01  road_bonus
  1.56     86.69     2.11  4777403     0.00     0.00  get_from_mapqueue
  1.42     88.60     1.91  6137906     0.00     0.00  map_get_continent
  1.25     90.29     1.69  4772140     0.00     0.00  add_to_mapqueue
  1.23     91.95     1.66      249     6.67    49.98  auto_settler_findwork
  1.22     93.59     1.64  3994188     0.00     0.00  map_get_special

...

  0.00    134.95     0.00        1     0.00     1.02  wipe_unit

which is an improvement of about 9 percent.  I also looked at the size
of the resulting civserver executables; my version was about 40k
larger:

   text    data     bss     dec     hex filename
 580423   14348  598624 1193395  1235b3 server/civserver

versus

   text    data     bss     dec     hex filename
 543095   14348  598624 1156067  11a3e3 server/civserver

It is my belief that anyone with a sufficiently small machine to worry
about 40k will appreciate the speedup much more than they will worry
about the loss of memory.

Anyone who wishes to have a closer look at these results can get the
following files from my web page: fast_map3.diff,
civserver.cvs.pg.gprof.out, civserver.cvs.fast_map.gprof.out

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
OVER the underpass!  UNDER the overpass!  Around the FUTURE
 and BEYOND REPAIR!!



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