Boost logo

Boost Users :

Subject: Re: [Boost-users] Default table size of unordered map
From: Daniel James (daniel_james_at_[hidden])
Date: 2009-07-01 04:15:37


2009/7/1 Dominique Devienne <ddevienne_at_[hidden]>:
> On Tue, Jun 30, 2009 at 9:18 PM, MeMooMeM<mbelgin_at_[hidden]> wrote:
>> What is the default table size of unordered maps in boost? I am trying to
>> figure out how scalable this function is. My guess is that boost assumes a
>> default initial table length. If it is exceeded, it needs to re-create
>> hashes for all entries to grow it, which is costly. I would like to find
>> that threshold...
>>
>> Thanks so much!
>
> See http://www.boost.org/doc/libs/1_39_0/doc/html/unordered/buckets.html#unordered.buckets.controlling_the_number_of_buckets

That part of the documentation should also mention that you can also
give a minimum number of buckets in the constructor. So if you want to
start with a least 10000 buckets:

    boost::unordered_map<int, int> m(10000);

Also, if you're concerned about scalability, don't use boost 1.38,
there's a bug in it which causes performance to degrade for large
numbers of buckets.

Daniel


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net