Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] [Patch] simple_ai_unit_type_iterate
Home

[Freeciv-Dev] [Patch] simple_ai_unit_type_iterate

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] [Patch] simple_ai_unit_type_iterate
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Mar 2002 12:47:52 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

From a normal profile:
 12.74     85.40    85.40   153125     0.56     0.75  really_generate_warmap
  3.39    108.13    22.73 436808118     0.00     0.00  unit_type_flag
  2.27    123.38    15.25 273606646     0.00     0.00  map_get_terrain
...
                1.31    0.00 25237753/436808118     get_virtual_defense_power 
[92]
                7.09    0.00 136191668/436808118     
can_player_build_unit_direct [58]
                8.82    0.00 169424868/436808118     is_ai_simple_military [73]
[49]     3.4   22.73    0.00 436808118         unit_type_flag [49]
...
-----------------------------------------------
                0.08    0.15  986426/63817558     process_defender_want [235]
                0.13    0.26 1682044/63817558     ai_choose_defender_limited 
[213]
                0.13    0.27 1725048/63817558     process_attacker_want [192]
                0.22    0.44 2852720/63817558     ai_choose_attacker [184]
                4.37    8.76 56571320/63817558     ai_choose_defender_versus 
[20]
[73]     2.2    4.93    9.88 63817558         is_ai_simple_military [73]
                8.82    0.00 169424868/436808118     unit_type_flag [49]
                1.06    0.00 50356121/315814946     get_unit_type [122]
-----------------------------------------------

It turns out that is_ai_simple_military can be computed before the
game starts. The patch does this and replaces the calls with a new
iterate. Another 2.2% speedup.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  "The primary purpose of the DATA statement is to give names to
   constants; instead of referring to pi as 3.141592653589793 at every
   appearance, the variable PI can be given that value with a DATA
   statement and used instead of the longer form of the constant. This
   also simplifies modifying the program, should the value of pi
   change."
    -- FORTRAN manual for Xerox Computers

Attachment: simple_ai_unit_type_iterate1.diff
Description: Text document


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