* merge.cc (Object_merge_map::initialize_input_to_output_map):

Reserve space in the hash table.
This commit is contained in:
Ian Lance Taylor 2009-07-09 23:29:55 +00:00
parent b75f0b83bc
commit 37c3b7b014
2 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2009-07-09 Ian Lance Taylor <iant@google.com>
* merge.cc (Object_merge_map::initialize_input_to_output_map):
Reserve space in the hash table.
2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
* fileread.cc (File_read::get_mtime): New method.

View file

@ -204,6 +204,12 @@ Object_merge_map::initialize_input_to_output_map(
Input_merge_map* map = this->get_input_merge_map(shndx);
gold_assert(map != NULL);
gold_assert(initialize_map->empty());
// We know how many entries we are going to add.
// reserve_unordered_map takes an expected count of buckets, not a
// count of elements, so double it to try to reduce collisions.
reserve_unordered_map(initialize_map, map->entries.size() * 2);
for (Input_merge_map::Entries::const_iterator p = map->entries.begin();
p != map->entries.end();
++p)