[patch] Use a std::vector instead of a std::map to hold Input_merge_map

Rafael Espíndola rafael.espindola@gmail.com
Tue Jun 2 02:43:00 GMT 2015


> Out of curiosity, did you try using an Unordered_map instead of
> std::map? (While also removing first_map_ and second_map_.) I wonder
> where the break-even point is between using a hash map and a linear
> search.

I had not, but I just did. All the times are for linking chromium with
--gc-sections but without icf and averaged over 30 runs:

* master:            6.149269079 seconds time elapsed ( +-  0.23% )
* a plain std::map:  6.115071123 seconds time elapsed ( +-  0.28% )
* a Unordered_map:   6.124765337 seconds time elapsed ( +-  0.22% )
* a std::vector:     6.027828962 seconds time elapsed ( +-  0.19% )

>> 2015-04-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
>>
>>         * merge.cc (get_input_merge_map): Update for data structure change.
>>           (get_or_make_input_merge_map): Update for data structure change.
>>         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
>>           a std::map.
>
> Please add a note in the ChangeLog entry about removing first_shnum_, etc.
>
> This is OK. Thanks!


Thanks,
Rafael



More information about the Binutils mailing list