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 15:22:23

Michael Fawcett <michael.fawcett <at>> writes:

> On Wed, Nov 5, 2008 at 2:38 PM, Joaquin M Lopez Munoz
> <joaquin <at>> wrote:
> > 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.
> I was trying this as you responded. I tried 23 and things improved
> greatly. It now uses less memory than std::map (as you suspected) by
> about 1%, or 1.2MB in my small graph test case. This will go up to
> about 120MB in my large graph test case, so that's very helpful.

Ummm.. It should be still less than that, as the overhead of the
hashed index is now vey close to 2 pointers per element, while
std::map incurs at best 3 pointers per element.

Can you declare some iterator "it" to the hashed index and
evaluate the following expression


and compare with


> For more gains over std::map -
> Graph load times decreased by 3.4%.
> Graph search time decreased by 17%.
> Graph save times decreased by 14%.
> By the way, I've always been impressed by how quickly you respond on
> these mailing lists in the past. You continue to impress ;)

Nothing to be proud of --I just spend too much time
on the Internet :)

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

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at