Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-index] hash_unique memory consumption vs std::map
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2008-11-05 15:44:02


On Wed, Nov 5, 2008 at 3:22 PM, Joaquin M Lopez Munoz <joaquin_at_[hidden]> wrote:
>
> 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
>
> sizeof(*(it.get_node()));
>
> and compare with
>
> sizeof(id_attribute_pair_type)

You're right. The first prints out 32, the second prints out 24. In
my test graph there are 106,096 edges in the graph. Each edge has 22
attributes.

In the hashed_index case, this results in a bucket_array with
bucket_count() == 23 and 8 bytes overhead per node with a node (in my
case) at 24 bytes. So that means 106,096 * 23 * 32 == 78,086,656
bytes.

In the std::map case, this results in 22 nodes at 12 bytes overhead
per node. 106,096 * 22 * 36 == 84,028,032 bytes.

I'm thinking I probably missed a digit in my previous email.

--Michael Fawcett


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