[Freeciv-Dev] [patch #4933] reduce the number of calls to normalize_map_pos()

2014-07-20 Thread pepeto
Update of patch #4933 (project freeciv):

  Status:  Ready For Test = Done   
 Open/Closed:Open = Closed 


___

Reply to this item at:

  http://gna.org/patch/?4933

___
  Message posté via/par Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4933] reduce the number of calls to normalize_map_pos()

2014-07-19 Thread pepeto
Update of patch #4933 (project freeciv):

 Assigned to:None = pepeto 
 Planned Release: = 2.5.0, 2.6.0   


___

Reply to this item at:

  http://gna.org/patch/?4933

___
  Message posté via/par Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4933] reduce the number of calls to normalize_map_pos()

2014-07-12 Thread Emmet Hikory
Follow-up Comment #1, patch #4933 (project freeciv):

Testing with this applied seems to take nearly the same amount of wall-clock
time (differences varied by run, but never exceeded 1% in either direction
against the same autogame).  map_pos_to_tile() sample percentage with this
applied seems to approximate prior combined sample percentage of
map_pos_to_tile() and normalize_map_pos().  Generally speaking, the sample
percentage of other functions seem to show very slight rises, and there
usually an increase in the number of functions requiring more than 1% CPU
time, so I believe this change improves things, but perhaps not enough to
warrant application to earlier branches.

___

Reply to this item at:

  http://gna.org/patch/?4933

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4933] reduce the number of calls to normalize_map_pos()

2014-07-12 Thread pepeto
Follow-up Comment #2, patch #4933 (project freeciv):

I have got better results when profiling. Without the patch:

 10.48269.30   269.30 6034611504 0.00 0.00  normalize_map_pos
  7.72467.57   198.27 1074190408 0.00 0.00  pf_normal_map_iterate
  7.02647.97   180.40 209839846 0.00 0.00  pf_fuel_map_iterate
  5.44787.69   139.72 924377761 0.00 0.00  pf_jumbo_map_iterate
  4.50903.37   115.68 8325248516 0.00 0.00  are_reqs_active
  4.31   1014.14   110.77 246671460 0.00 0.00 
get_fuel_moves_left_req
  2.57   1080.1265.98 3389242058 0.00 0.00  map_is_known_and_seen
  2.37   1140.9660.84 4665055165 0.00 0.00  mapstep
  2.28   1199.5458.58 19112205604 0.00 0.00  genlist_head
  2.11   1253.6954.15 3499063457 0.00 0.00  is_possible_base_fuel
[...]
  0.00   2568.45 0.001 0.00 0.00 
update_nations_with_startpos

---
0.160.56  348441/246671460 pf_map_new [291]
  110.61  395.53 246323019/246671460 pf_fuel_map_iterate [6]
[14]19.7  110.77  396.08 246671460 get_fuel_moves_left_req [14]
   54.15   88.79 3499063457/3499063457 is_possible_base_fuel
[31]
  134.060.00 3004180578/6034611504 normalize_map_pos [23]
   18.72   99.47 3256558157/3391373619 tile_get_known [36]
0.890.00 238401421/238403898
map_vector_to_real_distance [341]
---
   21.43  102.92 4655/4655 find_something_to_kill [9]
[35] 4.8   21.43  102.92 4655 invasion_funct [35]
   55.830.00 1251036497/6034611504 normalize_map_pos [23]
0.51   27.65 173400395/179506916 dai_diplomacy_get [86]
   14.343.09 3577616760/12850609884 tile_city [52]
0.520.00 361939781/1712405090 city_owner [246]
0.280.07 15776297/16347949 base_get_defense_power
[442]
0.340.00 188539386/202124883 player_diplstate_get
[445]
0.070.00 4655/2911444067 unit_owner [196]
0.050.00 15895384/19112205604 genlist_head [59]
0.010.04 18246946/177351059 is_military_unit [421]
0.040.00 4655/238149 unit_tile [275]
0.030.00 15895384/1397822721 city_tile [242]
0.020.00 18246946/22158942239 genlist_link_data [88]
0.010.00 18246946/22146923648 genlist_link_next [126]
0.010.00 15712070/1023670836 unit_class [373]
0.000.00  183314/51700509 city_ai_data [322]
0.000.00  183314/1086797480 unit_has_type_flag [259]
0.000.00  182001/4476158273 unit_type [179]
---


With the patch:

  7.59175.57   175.57 1074190408 0.00 0.00  pf_normal_map_iterate
  7.07339.07   163.50 209839846 0.00 0.00  pf_fuel_map_iterate
  6.69493.82   154.75 22061795161 0.00 0.00  map_pos_to_tile
  5.04610.41   116.59 8325248516 0.00 0.00  are_reqs_active
  4.58716.39   105.98 924377761 0.00 0.00  pf_jumbo_map_iterate
  3.07787.4871.09 4665055165 0.00 0.00  mapstep
  2.68849.5062.02 3499063457 0.00 0.00  is_possible_base_fuel
  2.62910.1660.66 19112205595 0.00 0.00  genlist_head
  2.60970.2460.08 3389242058 0.00 0.00  map_is_known_and_seen
  2.25   1022.3052.07 10054990814 0.00 0.00  map_move_cost
[...]
  0.00   2312.28 0.001 0.00 0.00 
update_nations_with_startpos

---
0.050.43  348441/246671460 pf_map_new [286]
   38.65  307.13 246323019/246671460 pf_fuel_map_iterate [6]
[17]15.0   38.70  307.57 246671460 get_fuel_moves_left_req [17]
   62.02   87.07 3499063457/3499063457 is_possible_base_fuel
[27]
   36.98   93.40 3256558157/3391373619 tile_get_known [31]
   27.410.00 3908096703/22061795161 map_pos_to_tile [26]
0.690.00 238401421/238403898
map_vector_to_real_distance [367]
---
7.86   68.37 4655/4655 find_something_to_kill [9]
[50] 3.37.86   68.37 4655 invasion_funct [50]
   25.640.00 3655590811/22061795161 map_pos_to_tile [26]
0.52   23.71 173400395/179506916 dai_diplomacy_get [94]
   13.343.24 3577616760/12850609884 tile_city [56]
0.830.00 361939781/1712405090 city_owner [210]
0.490.00 

[Freeciv-Dev] [patch #4933] reduce the number of calls to normalize_map_pos()

2014-07-12 Thread Emmet Hikory
Follow-up Comment #3, patch #4933 (project freeciv):

Interesting.  Possibly bad luck on my part, or differences between gprof and
oprofile.  If this patch produces a nearly 10% improvement in total runtime
for some initial conditions, perhaps it should also be applied to 2.5.

___

Reply to this item at:

  http://gna.org/patch/?4933

___
  Message sent via/by Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4933] reduce the number of calls to normalize_map_pos()

2014-07-12 Thread pepeto
Follow-up Comment #4, patch #4933 (project freeciv):

I think the most of the gain is visible in late game (when the AI begins to
build fueled units). It may explain why results could be so different.


___

Reply to this item at:

  http://gna.org/patch/?4933

___
  Message posté via/par Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [patch #4933] reduce the number of calls to normalize_map_pos()

2014-07-11 Thread pepeto
URL:
  http://gna.org/patch/?4933

 Summary: reduce the number of calls to normalize_map_pos()
 Project: Freeciv
Submitted by: pepeto
Submitted on: ven. 11 juil. 2014 22:47:32 CEST
Category: general
Priority: 5 - Normal
  Status: Ready For Test
 Privacy: Public
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 

___

Details:

Profiling trunk autogames shows that normalize_map_pos is abnormally used
(sometimes takes 10%). The attached patch reduce the number of the calls,
using map_pos_to_tile() in map macros.

Made for trunk, but could apply other branches too.




___

File Attachments:


---
Date: ven. 11 juil. 2014 22:47:32 CEST  Name: map_iterators.patch  Size: 2 ko 
 By: pepeto

http://gna.org/patch/download.php?file_id=21358

___

Reply to this item at:

  http://gna.org/patch/?4933

___
  Message posté via/par Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev