This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: basic_string capacity strategy < 128 characters


On Wed, Jun 11, 2003 at 10:36:31PM +0200, Paolo Carlini wrote:
> A quick comment (more later): asymptotic (i.e., amortized) linear 
> bahavior is something very precisely defined, as the concept of 
> asymptote is in basic calculus. It means that does not matter what 
> happens for small numbers, only what happens when the number becomes 
> larger and larger. This is only to point out that our implementation, as 
> far as this issue is concerned, is _absolutely_ conforming.

Yep.

> That the behavior for small strings, a well defined allocator, a well 
> defined architecture and a well defined application can be improved is 
> another matter.

<musing style="random" mode="aloud">

I wonder how much work it would be to store the initial N characters in the
basic_string itself as a member array, and not even bother with allocating
until capacity() grows beyond N.  For small strings, where small <= N,
I'm told this can be a performance boost.

Yet another ABI-destroying change, wheee!

</musing>

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]