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: 385

Filed under:
|
|

Guys, I am using dynamic programming approach to solve a problem. Here is a brief overview of the approach

  1. Each value generated is identified using 25 unique keys.
  2. I use the boost::hash_combine to generate the seed for the hash table using these 25 keys.
  3. I store the values in a hash table declared as

    boost::unordered_map<Key_Object, Data_Object, HashFunction> hashState;

  4. 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.

  5. 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

  1. Is there anything which I can do to improve the performance of the Hash Table's insert/retrieve operations?

  2. 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

Related posts about boost

Related posts about unordered-map