URL:
<http://gna.org/bugs/?22944>
Summary: Profiling of current SVN trunk
Project: Freeciv
Submitted by: andreasr
Submitted on: Tue 11 Nov 2014 10:07:24 PM UTC
Category: general
Severity: 3 - Normal
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release:
Discussion Lock: Any
Operating System: GNU/Linux
Planned Release:
_______________________________________________________
Details:
I just did some profiling of the current Freeciv svn trunk to get an
impression of where the CPU usage is being spent.
The following functions are on the top of the list, could they perhaps be
improved in some way?
is_req_active, check_fow, are_reqs_active, get_target_bonus_effects,
pf_normal_map_iterate
By the way, the Freeciv server is currently the process which uses
significantly the most CPU time on the Freeciv-web server,
so any improvement in performance improvement in the Freeciv server will allow
the server to scale better to handle more players.
For example, closely examining is_req_active() for performance improvements
seems to me to be a good place to start.
Can we improve is_req_active() in some significant way, for example by caching
it?
This is the output of gprof (full file attached):
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
9.74 1.23 1.23 128297053 0.00 0.00 is_req_active
9.50 2.43 1.20 104 11.54 19.86 check_fow
7.21 3.34 0.91 113361432 0.00 0.00 are_reqs_active
4.35 3.89 0.55 26099980 0.00 0.00
get_target_bonus_effects
2.53 4.21 0.32 1267266 0.00 0.00 pf_normal_map_iterate
2.53 4.53 0.32 307840704 0.00 0.00 player_slot_next
2.38 4.83 0.30 66538393 0.00 0.00 map_pos_to_tile
2.14 5.10 0.27 88371 0.00 0.00 tile_set_owner
2.06 5.36 0.26 187607175 0.00 0.00 tile_city
1.90 5.60 0.24 54681480 0.00 0.00 is_building_in_range
1.82 5.83 0.23 54895461 0.00 0.00 improvement_obsolete
1.82 6.06 0.23 1924388 0.00 0.00 player_slot_first
1.74 6.28 0.22 180566304 0.00 0.00 genlist_link_data
1.66 6.49 0.21 620653 0.00 0.00 genhash_maybe_resize
1.50 6.68 0.19 5267315 0.00 0.00
base_get_direction_for_step
1.43 6.86 0.18 104 1.73 23.68 real_sanity_check
1.19 7.01 0.15 54594983 0.00 0.00 city_has_building
1.11 7.15 0.14 req_get_values
1.11 7.29 0.14 307027636 0.00 0.00 player_slot_get_player
1.11 7.43 0.14 62834371 0.00 0.00 genlist_head
1.11 7.57 0.14 8466736 0.00 0.00 is_tech_in_range
1.11 7.71 0.14 808394 0.00 0.00 player_slot_index
1.03 7.84 0.13 genlist_release_mutex
0.87 7.95 0.11 29602 0.00 0.00 dai_effect_value
0.79 8.05 0.10 178521410 0.00 0.00 genlist_link_next
0.79 8.15 0.10 52961007 0.00 0.00 tile_has_road
0.71 8.24 0.09 73069603 0.00 0.00 improvement_index
0.71 8.33 0.09 12572385 0.00 0.00
get_city_tile_output_bonus
0.71 8.42 0.09 15545 0.01 0.01
city_total_unit_gold_upkeep
0.63 8.50 0.08 1543384 0.00 0.00 genlist_link_prev
0.63 8.58 0.08 4194669 0.00 0.00 tile_roads_output_incr
0.63 8.66 0.08 405754 0.00 0.00 get_activity_rate
0.63 8.74 0.08 37192 0.00 0.00 timer_stop
0.63 8.82 0.08 tile_has_road_flag
0.55 8.89 0.07 442 0.16 2.98 auto_settlers_player
0.55 8.96 0.07 37964950 0.00 0.00
terrain_type_terrain_class
0.55 9.03 0.07 92 0.76 0.76
can_improvement_go_obsolete
0.48 9.09 0.06 53439476 0.00 0.00 tile_has_extra
0.48 9.15 0.06 18204810 0.00 0.00
extra_type_list_by_cause
0.48 9.21 0.06 16181454 0.00 0.00 valid_advance_by_number
0.48 9.27 0.06 4194669 0.00 0.00 city_tile_output
0.48 9.33 0.06 8031 0.01 0.01 city_name
0.40 9.38 0.05 20226 0.00 0.00 genlist_link
0.40 9.43 0.05 1909 0.03 0.43 cm_find_best_solution
0.40 9.48 0.05 1577 0.03 0.03 tile_has_native_base
0.40 9.53 0.05 455 0.11 0.30 calc_civ_score
0.40 9.58 0.05 10 5.00 5.00 is_building_replaced
0.40 9.63 0.05 1 50.00 94.28 make_land
0.40 9.68 0.05 1 50.00 50.00 map_init
0.32 9.72 0.04 35343014 0.00 0.00 extra_by_number
0.32 9.76 0.04 20280080 0.00 0.00 map_get_player_tile
0.32 9.80 0.04 18991426 0.00 0.00 improvement_array_last
0.32 9.84 0.04 13056270 0.00 0.00 tile_extras
0.32 9.88 0.04 9537084 0.00 0.00 advance_number
0.32 9.92 0.04 5262019 0.00 0.00 normal_move
0.32 9.96 0.04 1051089 0.00 0.00 extra_base_get
0.32 10.00 0.04 430574 0.00 0.00 is_my_zoc
0.32 10.04 0.04 81344 0.00 0.00
can_attack_from_non_native
0.24 10.07 0.03 55079333 0.00 0.00 road_extra_get
0.24 10.10 0.03 124479 0.00 0.00
research_total_bulbs_required
0.24 10.13 0.03 4677 0.01 0.01 map_vision_update
0.24 10.16 0.03 4181 0.01 0.01 road_index
0.24 10.19 0.03 104 0.29 0.29 government_by_number
0.24 10.22 0.03 can_city_build_now
0.24 10.25 0.03 dbv_bits
0.24 10.28 0.03 28855492 0.00 0.00 city_owner
0.24 10.31 0.03 19280547 0.00 0.00 city_map_radius_sq_get
0.24 10.34 0.03 18243142 0.00 0.00 is_native_to_class
0.24 10.37 0.03 12867094 0.00 0.00 utype_has_flag
0.24 10.40 0.03 5265267 0.00 0.00 tile_move_cost_ptrs
0.24 10.43 0.03 5052174 0.00 0.00 get_city_output_bonus
0.24 10.46 0.03 4148473 0.00 0.00 is_city_center
0.24 10.49 0.03 1679320 0.00 0.00 city_waste
0.24 10.52 0.03 1088390 0.00 0.00 genhash_lookup
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Tue 11 Nov 2014 10:07:24 PM UTC Name: gprof.zip Size: 309kB By:
andreasr
<http://gna.org/bugs/download.php?file_id=22871>
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?22944>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev