Opened 5 years ago

Last modified 5 years ago

#13016 new Feature Requests

small buffer optimization for bool vector or dynamic_bitset

Reported by: gast128@… Owned by: jsiek
Milestone: To Be Determined Component: dynamic_bitset
Version: Boost 1.64.0 Severity: Optimization
Keywords: Cc:

Description

The small_vector addition (#9165) is great. However using this with Booleans gives space overhead. The std has anticipated this with the vector<bool> concept though not everybody is enthusiastic about this optimization. Unfortunately this one always allocates its data on the heap. What I need is the optimization of vector<bool> (or a dynamic_bitset) with the small buffer optimization.

The use case is that I keep bool (or a bit postion) for every connected pin which goes from 0 to max pins. 99% of the use cases the maximum pins are less than 10 though I do not want to set a maximum on it beforehand (so e.g. use of std::bitset with 32 values would rule this out, since that one is topped to 32).

see also http://stackoverflow.com/questions/7760678/is-there-a-bitset-class-thats-sized-at-instantiation-time-but-avoids-boostdy

Change History (1)

comment:1 by Ion Gaztañaga, 5 years ago

Component: containerdynamic_bitset
Owner: changed from Ion Gaztañaga to jsiek

Sorry but Boost.Container refused to have a boolean specialization for vector due to problems reported from std::vector and the idea is not to support any specialization for othe containers. More information here:

http://www.boost.org/doc/libs/1_64_0/doc/html/container/Cpp11_conformance.html#container.Cpp11_conformance.Vector_bool

Maybe this should proposed for Boost.DynamicBitset. Reassigning.

Note: See TracTickets for help on using tickets.