Using boost unordered map
Posted
by Amrish
on Stack Overflow
See other posts from Stack Overflow
or by Amrish
Published on 2010-05-02T21:39:47Z
Indexed on
2010/05/02
21:48 UTC
Read the original article
Hit count: 411
Guys, I am using dynamic programming approach to solve a problem. Here is a brief overview of the approach
- Each value generated is identified using 25 unique keys.
- I use the boost::hash_combine to generate the seed for the hash table using these 25 keys.
I store the values in a hash table declared as
boost::unordered_map<Key_Object, Data_Object, HashFunction> hashState;
I did a time profiling on my algorithm and found that nearly 95% of the run time is spent towards retrieving/inserting data into the hash table.
These were the details of my hash table
hashState.size() 1880
hashState.load_factor() 0.610588
hashState.bucket_count() 3079
hashState.max_size() 805306456
hashState.max_load_factor() 1
hashState.max_bucket_count() 805306457
I have the following two questions
Is there anything which I can do to improve the performance of the Hash Table's insert/retrieve operations?
C++ STL has hash_multimap which would also suit my requirement. How does boost libraries unordered_map compare with hash_multimap in terms of insert/retrieve performance.
© Stack Overflow or respective owner