A map and set which uses contiguous memory and has a reserve function

Posted by edA-qa mort-ora-y on Stack Overflow See other posts from Stack Overflow or by edA-qa mort-ora-y
Published on 2011-01-01T08:30:20Z Indexed on 2011/01/01 11:54 UTC
Read the original article Hit count: 328

Filed under:
|
|
|

I use several maps and sets. The lack of contiguous memory, and high number of (de)allocations, is a performance bottleneck. I need a mainly STL-compatbile map and set class which can use a contiguous block of memory for internal objects (or multiple blocks). It also needs to have a reserve function so that I can preallocate for expected sizes.

Before I write my own I'd like to check what is available first. Is there something in Boost which does this? Does somebody know of an available implementation elsewhere?


Intrusive collection types are not usable here as the same objects need to exist in several collections. As far as I know STL memory pools are per-type, not per instance. These global pools are not efficient with respect to memory locality in mutli-cpu/core processing.

Object pools don't work as the types will be shared between instance but their pool should not.

In many cases a hash map may be an option in some cases.

© Stack Overflow or respective owner

Related posts about c++

Related posts about boost