From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-10-20 11:39:15
On Sat, 19 Oct 2002 19:27:44 -0700, Alkis Evlogimenos
>dynamic_bitset<>::resize() always allocates a new block when called even if
>the number of blocks needed is the same.
Yeah yeah I know. Well, if the number of bits is the same too then
there's no reallocation :-)
Seriously, a lot of things need to be optimized in dynamic_bitset.
Functions like append(), the constructor from unsigned long and others
are among them. We have also deliberately excluded some optimizations
that were already done (for instance the obvious addition of an
overload of initial_num_blocks for random access iterators) in order
to keep changes to the release branch to a minimum.
I'll try and find the time to work again on the code. IMHO making it
fast is a "must" for such a class like an instantiation of
>This causes a performance bottleneck
>for appliations that use resize() frequently.
Which includes, for instance, applications that make wide use of
push_back(), I know.
>IMO it would be best to change
>the semantics of resize() to be the same as std::vector::resize() and at the
>same time provide a reserve() function.
I have thought to introduce a reserve function too, however I'll wait
to see if we really need it. More likely, the implementation will be
changed much more radically than what you propose. In any case, the
possibility of a reserve() is always there; for once we are lucky:
introducing it is not so a pervasive change as it would be if we
needed a separate member to keep track of the capacity :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk