aboutsummaryrefslogtreecommitdiff
path: root/gold/merge.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-07-09 23:29:55 +0000
committerIan Lance Taylor <ian@airs.com>2009-07-09 23:29:55 +0000
commit37c3b7b014271f52b30a7281eebc1f848bb7e66f (patch)
treeb9ba4252c135cbf3a3635545432f0669c768fe84 /gold/merge.cc
parentb75f0b83bcf016061f2634b8808cce7026bd8b96 (diff)
downloadgdb-37c3b7b014271f52b30a7281eebc1f848bb7e66f.zip
gdb-37c3b7b014271f52b30a7281eebc1f848bb7e66f.tar.gz
gdb-37c3b7b014271f52b30a7281eebc1f848bb7e66f.tar.bz2
* merge.cc (Object_merge_map::initialize_input_to_output_map):
Reserve space in the hash table.
Diffstat (limited to 'gold/merge.cc')
-rw-r--r--gold/merge.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gold/merge.cc b/gold/merge.cc
index 25ecc40..3d96921 100644
--- a/gold/merge.cc
+++ b/gold/merge.cc
@@ -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)