Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost or Standard when there is the choice?
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2014-02-16 12:34:52


Niall Douglas <s_sourceforge <at> nedprod.com> writes:

>
> On 16 Feb 2014 at 13:04, Daniel James wrote:
> >
> > According to Joaquin's recent benchmarks the recent standard
> > implementations are generally faster than the boost implementation,
> > which IMO is how it should be. I'm looking forward to
> > Boost.Unordered's obsolescence.
> >
> > http://bannalia.blogspot.co.uk/
>
> [...]
>
> Also, performance isn't everything, memory footprint is also very
> important. It's unfortunate that blog didn't show differences in
> unordered_map<> memory consumption. I'd warrant that Dinkumware's
> unordered_map<> is very, very good on memory footprint. For the other
> STLs, I wouldn't like to guess.

No practical measure was taken, but one can guess from the layout
of the different data structures as described in

http://bannalia.blogspot.com/2013/10/implementation-of-c-unordered.html
http://bannalia.blogspot.com/2013/10/implementation-of-c-unordered_25.html

The overhead (memory minus sizeof(value_type)) in words for a container
of N elments and B buckets is:

* Dinkum: 2B + 2N
* libstdc++: 1B + 2N (1B + 1N is hash is fast and does not throw)
* libc++: 1B + 2N
* Boost.Unordered
  - unique elements: 1B + 2N
  - duplicate elements: 1B + 3N
* Boost.MultiIndex: 1B + 2N

So, in fact Dinkumware and Boost.Unordered-duplicate are
the ones that use the most memory.

Joaquín M López Muñoz
Telefónica Digital


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