Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12315) Slowness
Home

[Freeciv-Dev] Re: (PR#12315) Slowness

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12315) Slowness
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 6 Mar 2005 09:50:45 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12315 >

On Mon, 21 Feb 2005, Christian Knoke wrote:
> The savegame attached to
>
> http://bugs.freeciv.org/Ticket/Display.html?id=12313
>
> contains 6 living AI players, and a total of 366 cities and 968 units.
>
> It requires 18 seconds (real) to start on a 2 GHz machine (time from click
> on 'start' button until it is responsive).

Interesting. Here is the profile output for just loading and starting the
game:

 time   seconds   seconds    calls   s/call   s/call  name
 28.57     57.38    57.38 204250680    0.00     0.00  building_has_effect
  8.77     74.99    17.61 62880122     0.00     0.00  get_city_bonus
  6.38     87.80    12.81 71122231     0.00     0.00  count_buildings_in_range
  6.20    100.25    12.45 204252518    0.00     0.00  req_source_get_values
  5.91    112.12    11.87 68082170     0.00     0.00  improvement_exists
  5.72    123.61    11.49 75306176     0.00     0.00  is_req_active
  5.70    135.06    11.45   298010     0.00     0.00  find_palace
  4.11    143.31     8.25 71122826     0.00     0.00  improvement_obsolete
  3.60    150.53     7.22  1377514     0.00     0.00  next_choice
  3.16    156.88     6.35 68059213     0.00     0.00  city_got_building
  2.20    161.29     4.41 71123607     0.00     0.00  tech_exists
  2.02    165.34     4.05   483775     0.00     0.00  danger_iterate_map
  1.98    169.32     3.98   422046     0.00     0.00  generic_city_refresh

[4]     94.4    0.08  189.55       1         ai_manage_buildings [4]
                0.08  183.23     713/729     ai_data_get <cycle 1> [531]
                0.01    5.00  483775/483775  pf_next [26]
                0.50    0.01  483774/483774  pf_next_get_position [45]

[5]     93.3    0.08  187.34     729+328     <cycle 1 as a whole> [5]
                0.01  187.25      16             ai_best_government <cycle 1> 
[6]
                0.07    0.09      16             ai_data_phase_init <cycle 1> 
[76]
                0.00    0.00      16             aiferry_init_stats <cycle 1> 
[295]
                0.00    0.00     881             ai_data_get <cycle 1> [531]

                                  16             ai_data_phase_init <cycle 1> 
[76]
[6]     93.2    0.01  187.25      16         ai_best_government <cycle 1> [6]
                0.00  186.41    2028/2028        auto_arrange_workers [7]
                0.02    0.80    2028/422046      generic_city_refresh [9]

                0.00  186.41    2028/2028        ai_best_government <cycle 1> 
[6]
[7]     92.8    0.00  186.41    2028         auto_arrange_workers [7]
                1.39  183.53    5112/5112        cm_query_result [8]

                1.39  183.53    5112/5112        auto_arrange_workers [7]
[8]     92.1    1.39  183.53    5112         cm_query_result [8]
                1.42  164.48  406666/406666      apply_solution [10]
                7.22    2.73 1377514/1377514     next_choice [22]

...

So it seems that it is the AI's government selection code that kicks in
for all nations at once, that makes the start so slow. Since all nations
seem to be able to use all govts, all govts are cycled through for all
cities, and there many cities in this savegame. So this is a lot of calls
to auto_arrange_workers()!

  - Per





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