Update of bug #21988 (project freeciv):

                  Status:                    None => In Progress            

    _______________________________________________________

Follow-up Comment #1:

The attached patch implements open hashing with chained list resolution.

I tried to use gprof (I doubt I did all right for my first attempt). Here the
stats I of the main genhash functions I get before applying the patch:

                0.00    0.00       1/15814665     luascript_func_hash_lookup
[2700]
                0.00    0.00      20/15814665     ruler_title_hash_lookup
[2304]
                0.00    0.00   50486/15814665     luascript_signal_hash_lookup
[1315]
                0.00    0.01  103598/15814665     entry_hash_lookup [1211]
                0.02    0.19 3334739/15814665     tile_data_cache_hash_lookup
[456]
                0.03    0.25 4457594/15814665     city_hash_lookup [412]
                0.05    0.44 7868227/15814665     unit_hash_lookup [325]
[259]    0.2    0.10    0.89 15814665         genhash_lookup [259]
                0.73    0.02 15814665/20699251     genhash_bucket_lookup
[261]
                0.02    0.12 15814665/20699251     genhash_val_calc [479]
                0.01    0.00 7469899/11477484     genhash_default_get [1119]
                0.00    0.00 8344766/8346049     genhash_bucket_get [2866]
-----------------------------------------------
                0.00    0.00      91/4007585     city_hash_replace_full [821]
                0.00    0.00    1192/4007585     unit_hash_replace_full
[1727]
                0.00    0.01   55587/4007585     entry_hash_replace_full
[1224]
                0.03    0.40 3950715/4007585     genhash_replace [353]
[356]    0.1    0.03    0.41 4007585         genhash_replace_full [356]
                0.18    0.00 4007585/20699251     genhash_bucket_lookup [261]
                0.10    0.07 4007585/4172241     genhash_maybe_resize <cycle
13> [582]
                0.00    0.03 4007585/20699251     genhash_val_calc [479]
                0.01    0.00 4007585/4883303     genhash_bucket_set [1012]
                0.00    0.00 4007585/11477484     genhash_default_get [1119]
-----------------------------------------------
                              874341             genhash_resize_table <cycle
13> [1066]
                0.00    0.00       1/4172241     luascript_func_hash_insert
[2729]
                0.00    0.00      16/4172241     luascript_signal_hash_insert
[2416]
                0.00    0.00    1360/4172241     section_hash_insert [1832]
[684]    0.0    0.01    0.05  875718         genhash_insert <cycle 13> [684]
                0.04    0.00  875718/20699251     genhash_bucket_lookup [261]
                0.00    0.01  875718/20699251     genhash_val_calc [479]
                0.00    0.00  875718/4883303     genhash_bucket_set [1012]
                              875718             genhash_maybe_resize <cycle
13> [582]
-----------------------------------------------
                              160178             genhash_destroy <cycle 12>
[1096]
                0.00    0.00    1818/163270      tile_data_cache_hash_clear
[1516]
[745]    0.0    0.04    0.01  161996         genhash_clear <cycle 12> [745]
                0.00    0.00  161996/4172241     genhash_maybe_resize <cycle
13> [582]
                             4006302             genhash_bucket_free <cycle
12> [2874]
-----------------------------------------------
                0.00    0.00      91/1283        city_hash_remove_full [1877]
                0.00    0.00    1192/1283        unit_hash_remove_full [1533]
[1527]   0.0    0.00    0.00    1283         genhash_remove_full [1527]
                0.00    0.00    1283/163270      genhash_bucket_free <cycle
12> [2874]
                0.00    0.00    1283/20699251     genhash_bucket_lookup [261]
                0.00    0.00    1283/4172241     genhash_maybe_resize <cycle
13> [582]
                0.00    0.00    1283/20699251     genhash_val_calc [479]
                0.00    0.00    1283/8346049     genhash_bucket_get [2866]


Here with the patch:

                0.00    0.11      10/111         server_remove_player [525]
                0.00    1.16     101/111         end_turn [247]
[259]    0.2    0.00    1.27     111         map_calculate_borders [259]
                0.03    1.20    7347/8009        map_claim_border [254]
                0.01    0.03  431568/947467      is_border_source [633]
                0.00    0.00     111/344         city_thaw_workers_queue
[1074]
                0.00    0.00     111/1158        city_refresh_queue_processing
[868]
                0.00    0.00     222/23869926    
log_do_output_for_level_at_location [965]
-----------------------------------------------
                0.00    0.00      92/3551995     city_hash_replace_full
[2065]
                0.00    0.00    1294/3551995     unit_hash_replace_full
[1101]
                0.00    0.00   55587/3551995     entry_hash_replace_full
[1253]
                0.04    0.25 3495022/3551995     genhash_replace [422]
[439]    0.1    0.04    0.25 3551995         genhash_replace_full [439]
                0.06    0.04 3551995/25538307     genhash_slot_lookup [324]
                0.05    0.03 3551995/3696103     genhash_maybe_resize <cycle
14> [960]
                0.02    0.05 3551995/4322943     genhash_slot_create [682]
                0.01    0.00 3551995/16177353     genhash_default_get [882]
-----------------------------------------------
                              139508             genhash_destroy <cycle 13>
[2831]
                0.00    0.00    1836/142721      tile_data_cache_hash_clear
[1081]
[752]    0.0    0.05    0.00  141344         genhash_clear <cycle 13> [752]
                0.00    0.00  141344/3696103     genhash_maybe_resize <cycle
14> [960]
                             3551970             genhash_slot_free <cycle 13>
[1124]
-----------------------------------------------
                              769570             genhash_resize_table <cycle
14> [958]
                0.00    0.00       1/3696103     luascript_func_hash_insert
[2640]
                0.00    0.00      16/3696103     luascript_signal_hash_insert
[2373]
                0.00    0.00    1361/3696103     section_hash_insert [1889]
[775]    0.0    0.01    0.04  770948         genhash_insert <cycle 14> [775]
                0.01    0.01  770948/25538307     genhash_slot_lookup [324]
                0.00    0.01  770948/4322943     genhash_slot_create [682]
                              770948             genhash_maybe_resize <cycle
14> [960]
-----------------------------------------------
                0.00    0.00      92/1386        city_hash_remove_full [1848]
                0.00    0.00    1294/1386        unit_hash_remove_full [1501]
[1491]   0.0    0.00    0.00    1386         genhash_remove_full [1491]
                0.00    0.00    1386/142721      genhash_slot_free <cycle 13>
[1124]
                0.00    0.00    1386/25538307     genhash_slot_lookup [324]
                0.00    0.00    1386/3696103     genhash_maybe_resize <cycle
14> [960]
                0.00    0.00    1386/8590006     genhash_slot_get [884]


I used same mapseed, gameseed and same options, but I didn't get the same
number of function call. I don't know why (maybe a memory error in the
patch).

Waiting for comments or advices to improve the patch.

(file #20644)
    _______________________________________________________

Additional Item Attachment:

File name: genhash.diff                   Size:20 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?21988>

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


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

Reply via email to