Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269)
Home

[Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Cache win_chance in get_defender(attacker) (PR#1269)
From: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Date: Fri, 22 Feb 2002 21:33:04 +0000 (GMT)

So, 1 percent of all time.
Is it a lot?  I don't know...
But if we use win_chance everywhere we should, this would double.
However we can get it for free with my patch...

G.

 --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> On Fri, Feb 22, 2002 at 08:33:18PM +0000, Gregory Berkolaiko wrote:
> >  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > > profiling has to be made. I haven't done profiling in a long time.
> 
> I made an autogame with profiling (CHECK_MAP_POS disabled):
> 
> Flat profile:
> 
> Each sample counts as 0.01 seconds.
>   %   cumulative   self              self     total           
>  time   seconds   seconds    calls  ms/call  ms/call  name    
>  11.67     63.58    63.58   126346     0.50     0.71  really_generate_warmap
>   4.64     88.87    25.29 573434095     0.00     0.00  normalize_map_pos
>   2.89    104.59    15.72 352764568     0.00     0.00  unit_type_flag
>   2.79    119.78    15.19 241976520     0.00     0.00  tech_exists
>   2.40    132.83    13.05 255235503     0.00     0.00  map_get_terrain
>   2.25    145.06    12.23 129703250     0.00     0.00  base_city_map_to_map
>   2.16    156.83    11.77 168168833     0.00     0.00  map_get_city
>   1.98    167.60    10.77 348949403     0.00     0.00  map_get_tile
>   1.93    178.12    10.52 241305941     0.00     0.00  get_invention
>   1.91    188.51    10.39 381215045     0.00     0.00  contains_special
>   1.57    197.08     8.57 132635475     0.00     0.00  find_genlist_position
>   1.48    205.13     8.05 85332328     0.00     0.00  add_to_mapqueue
>   1.46    213.10     7.97 203268903     0.00     0.00  is_valid_city_coords
>   1.42    220.83     7.73 85486953     0.00     0.00  get_from_mapqueue
>   1.34    228.13     7.30 194013803     0.00     0.00  city_owner
>   1.31    235.28     7.15 142699816     0.00     0.00  improvement_exists
>   1.28    242.27     6.99  2073637     0.00     0.01 
> num_known_tech_with_flag
>   1.18    248.68     6.41 16230376     0.00     0.00 
> base_city_get_food_tile
>   1.16    254.99     6.31 205386069     0.00     0.00  unit_type
>   1.13    261.17     6.18      706     8.75    20.26  check_fow
>   1.08    267.04     5.87 91454901     0.00     0.00  map_get_continent
>   1.06    272.82     5.78  3303164     0.00     0.00  win_chance
>   1.04    278.51     5.69    31754     0.18     1.64  evaluate_improvements
>   1.03    284.12     5.61 101532135     0.00     0.00  city_got_building
>   1.01    289.60     5.48 17363437     0.00     0.00 
> base_city_get_shields_tile
>   1.00    295.07     5.47 132629051     0.00     0.00  genlist_iterator_init
>   0.99    300.47     5.40  2379222     0.00     0.01  invasion_funct
>   0.99    305.87     5.40    50381     0.11     2.93  find_something_to_kill
>   0.94    311.01     5.14  2571473     0.00     0.00  road_bonus
>   0.90    315.90     4.89 58142688     0.00     0.00 
> can_player_build_unit_direct
>   0.90    320.79     4.89 21959700     0.00     0.00  is_terrain_near_tile
>   0.84    325.37     4.58 259915099     0.00     0.00  get_unit_type
>   0.81    329.78     4.41     4854     0.91     3.95  ai_manage_explorer
>   0.80    334.16     4.38  3304326     0.00     0.00 
> city_reinforcements_cost_and_value
>   0.80    338.51     4.35 53480468     0.00     0.00  is_ai_simple_military
>   0.80    342.84     4.33 70943643     0.00     0.00  get_worker_city
>   0.79    347.14     4.30 13540572     0.00     0.00 
> base_city_get_trade_tile
>   0.77    351.35     4.21 97667466     0.00     0.00  tech_flag
>   0.76    355.48     4.13 36589356     0.00     0.00 
> city_affected_by_wonder
>   0.69    359.25     3.77    14187     0.27     1.10  find_the_shortest_path
>   0.66    362.83     3.58 50441081     0.00     0.00  map_has_special
>   0.64    366.32     3.49  5735786     0.00     0.00  goto_is_sane
>   0.64    369.79     3.47 98690969     0.00     0.00  get_gov_pcity
>   0.62    373.18     3.39 38733175     0.00     0.00  can_build_unit
>   0.62    376.56     3.38 83876147     0.00     0.00  unit_type_exists
>   0.62    379.92     3.36 17471404     0.00     0.00  is_already_assigned
>   0.61    383.25     3.33  3748315     0.00     0.00  dangerfunct
>   0.58    386.41     3.16 44990910     0.00     0.00  map_get_player_tile
>   0.57    389.50     3.09 55095232     0.00     0.00  city_map_to_map
>   0.54    392.46     2.96  6762895     0.00     0.00 
> get_virtual_defense_power
>   0.54    395.38     2.92 10492128     0.00     0.01  city_tile_value
>   0.53    398.24     2.86 39315783     0.00     0.00  can_build_unit_direct
>   0.53    401.10     2.86   909939     0.00     0.06 
> ai_choose_defender_versus
>   0.52    403.95     2.85  5499584     0.00     0.00  amortize
>   0.51    406.73     2.78 100009201     0.00     0.00  get_government
>   0.48    409.36     2.63  3973657     0.00     0.00  is_my_zoc
>   0.48    411.96     2.60    31754     0.08     1.42  evaluate_city_building
>   0.47    414.52     2.56 18733526     0.00     0.00  hash_fval_int
>   0.45    416.99     2.47 43123629     0.00     0.00  map_get_known
>   0.45    419.46     2.47  7294383     0.00     0.00 
> get_total_defense_power
>   0.44    421.86     2.40    29589     0.08     0.97  assess_danger
>   0.44    424.23     2.37 50827645     0.00     0.00  map_get_special
>   0.43    426.59     2.36 100007221     0.00     0.00  get_gov_pplayer
>   0.43    428.91     2.32 87041572     0.00     0.00  get_tile_type
>   0.40    431.08     2.17 44992537     0.00     0.00  nearest_real_pos
>   0.40    433.24     2.16 56140996     0.00     0.00  is_wonder
>   0.39    435.37     2.13 18762624     0.00     0.00  internal_lookup
>   0.38    437.44     2.07 38586177     0.00     0.00  base_city_celebrating
>   0.38    439.50     2.06 69428739     0.00     0.00  unit_flag
>   0.37    441.54     2.04 47468287     0.00     0.00  is_sailing_unit
>   0.37    443.55     2.01  3241725     0.00     0.01  get_defender
>   0.37    445.56     2.01   900169     0.00     0.01  server_set_tile_city
>   0.34    447.43     1.87 27989515     0.00     0.00 
> is_non_allied_unit_tile
>   0.33    449.25     1.82 37253673     0.00     0.00  wonder_obsolete
>   0.33    451.07     1.82     3522     0.52     1.00  ai_select_tech
>   0.33    452.86     1.79 42276829     0.00     0.00  unit_owner
>   0.33    454.64     1.78 46066274     0.00     0.00  is_real_tile
>   0.32    456.40     1.76 21440047     0.00     0.00  map_distance_vector
>   0.32    458.16     1.76   577820     0.00     0.02  city_desirability
>   0.32    459.91     1.75  1158899     0.00     0.00  find_palace
>   0.32    461.63     1.72 38949448     0.00     0.00  is_tech_a_req_for_goal
>   0.31    463.31     1.68 63784036     0.00     0.00  get_player
>   0.30    464.93     1.62 13360431     0.00     0.00  food_weighting
>   0.27    466.39     1.46 38022047     0.00     0.00  city_celebrating
>   0.27    467.85     1.46 20205040     0.00     0.00  real_map_distance
>   0.26    469.29     1.44 39620372     0.00     0.00  is_ground_unit
>   0.26    470.71     1.42  8039707     0.00     0.00  get_defense_power
>   0.26    472.12     1.41 18747026     0.00     0.00  hash_lookup_data
>   0.24    473.41     1.29      332     3.89    18.23  player_save
>   0.23    474.67     1.26  1036504     0.00     0.00 
> city_exists_within_city_radius
>   0.22    475.87     1.20    36061     0.03     0.13  look_for_charge
>   0.21    477.04     1.17 40554057     0.00     0.00  is_city_center
>   0.21    478.19     1.15 44599242     0.00     0.00  same_pos
>   0.21    479.32     1.13  6372427     0.00     0.00  get_modified_firepower
>   0.20    480.42     1.10  6881717     0.00     0.00 
> consider_settler_action
>   0.19    481.48     1.06 13181932     0.00     0.00  city_get_food_tile
>   0.19    482.54     1.06   175864     0.01     0.01  sync_cities
>   0.19    483.58     1.04   345664     0.00     0.01  find_boat
>   0.19    484.61     1.03 14314993     0.00     0.00  city_get_shields_tile
>   0.19    485.64     1.03  2089426     0.00     0.00  city_can_be_built_here
>   0.18    486.63     0.99   564130     0.00     0.04  set_food_trade_shields
>   0.17    487.56     0.93   577820     0.00     0.01  is_square_threatened
>   0.17    488.49     0.93   564130     0.00     0.00  city_support
>   0.17    489.41     0.92 11721152     0.00     0.00 
> unit_really_ignores_citywalls
>   0.16    490.29     0.88      706     1.25     3.95  check_map
>   0.16    491.15     0.86 10331687     0.00     0.00  get_empty_array
>   0.16    492.00     0.85  3067982     0.00     0.00  get_defense_rating
>   0.15    492.84     0.84    72845     0.01     0.52  worker_loop
>   0.15    493.67     0.83  3748315     0.00     0.00  assess_distance
>   0.15    494.47     0.80  1965269     0.00     0.00  mystrlcpy
>   0.15    495.26     0.79 14782415     0.00     0.00  player_find_city_by_id
>   0.14    496.04     0.78   492163     0.00     0.00 
> is_building_other_wonder
>   0.14    496.81     0.77  3748315     0.00     0.00  assess_danger_unit
>   0.14    497.58     0.77    29562     0.03     0.50  ai_eval_buildings
>   0.14    498.32     0.74   919875     0.00     0.00  base_map_to_city_map
>   0.13    499.05     0.73 22224534     0.00     0.00  is_air_unit
>   0.13    499.77     0.72   251694     0.00     0.10  ai_find_elvis_pos
>   0.13    500.49     0.72      706     1.02     3.78  check_cities
>   0.13    501.20     0.71 18365467     0.00     0.00  idex_lookup_city
>   0.12    501.88     0.68  1711913     0.00     0.00  fz_fprintf
>   0.12    502.55     0.67 10492128     0.00     0.00  city_get_trade_tile
>   0.12    503.20     0.65  6740888     0.00     0.00 
> ground_unit_transporter_capacity
>   0.12    503.85     0.65   154625     0.00     0.00  init_queue
>   0.12    504.49     0.64  7883310     0.00     0.00  pplayers_allied
>   0.12    505.13     0.64  1902773     0.00     0.00 
> could_player_eventually_build_improvement
>   0.12    505.76     0.63 22688279     0.00     0.00  tile_has_special
>   0.11    506.36     0.60  3303164     0.00     0.00  unit_win_chance
> 
>       Raimar
> 
> -- 
>  email: rf13@xxxxxxxxxxxxxxxxx
>     1) Customers cause problems.
>     2) Marketing is trying to create more customers.
>   Therefore:
>     3) Marketing is evil.
>  

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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