Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-index] hash_unique memory consumption vs std::map
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2008-11-05 14:38:56


Michael Fawcett <michael.fawcett <at> gmail.com> writes:
>
> On Wed, Nov 5, 2008 at 5:27 AM, <joaquin <at> tid.es> wrote:
> > The member function bucket_count() gives you the size of the
> > bucket array. Is this indeed much larger than the number of elements?
>
> It is indeed much larger. I have 22 attributes with my particular
> test graph. bucket_count() is 53.

Oh, sorry, I didn't understand your scenario at first. I thought
you have one container with millions of elements, when what you
have is millions of containers with a few elements (22) each. Is
that right?

> I investigated further and this is
> because 53 is the lowest possible size for bucket_array_base. Should
> I just stick to using std::map when I know that N will be less than
> 53, or would modifying prime_list[] make sense?

Absolutely, just add some prime which is roughly 53/2, say 23.
I'm sorry this is forcing you to change B.MI source code.
Please report back whether this improves things.

[rest snipped as it's clear to me now]

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


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