Boost logo

Boost Users :

Subject: Re: [Boost-users] [Multi-index container] Why insertions into my Multi-index container are so slow?
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2008-09-04 12:44:50


Angel Sunye <angelsunye <at> gmail.com> writes:

> Perfect!!!... Just I had
>
> #if !defined(NDEBUG)
> #define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
> #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
> #endif
>
> and I haven't defined NDEBUG!!!
>
> Now, time is much better than before, but still continues slow
> than manually.

OK, this seems to explain most of the issue.
What's the ratio t(multi_index)/t(manual) in debug and
release modes after suppresing safe mode and invariant-
checking?

[...]
> > * Are you able to isolate this odd behavior in a complete
> > program that you can send to me so that I can reproduce
> > the problem locally?
>  
> Copied before

Unfortunately, the snippet you pasted above is not a complete
program that I can compile and run, and it is not obvious
how to fill in the missing parts. So, I can only speculate
after visually inspecting the code. In general, using a
multi_index_container with two indices should be faster than
relying in two synced containers: the manual version differs
quite a bit from the multi_index variation, so I don't
know whether they are really equivalent. In the multi_index
version you're providing end() as an insertion hint: this
is probably a misguided hint and omitting it should speed
things up a little, though I don't think it'll make a dramatic
difference.

Other than this I can't be much more helpful. If you're
in a position to provide me with a complete example program
that I can play with I'll sure have a deeper look.

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