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]

Re: [Fwd: basic_string<> - useless because of its poor performance



>The "amortized linear" requirement means that adding <N> characters 
><M> times should take o(NM) time.  (<X> is a random variable with
>expectation X.)  With a linear allocation strategy, allocation time
>dominates the runtime, and you get much slower performance than NM, 
>as measured.  With an exponential allocation strategy, allocation time
>drops out and the copying time dominates, as required.

OK, fully understood now.  I was making the mistake that malloc()
dominated O() not the copying...


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