This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Performance Gcc 3.3.1 VS 2.95.1


> Ouch!  By manipulating the capacity in that way, you force quadratic
> performance!  The string has to be reallocated every time.  Take out
> your explicit management of capacity and things will get much faster.

> If 2.95.1 ran this code faster, I assume it must have ignored your
>calls to reserve().

Not necessarily. basic_string::reserve guarantees *at least* the
requested capacity; it may well allocate more.  If, f'rinstance,
2.95.1 rounded reservations up to the next multiple of 64 chars, and
3.3.1 rounded up to the next multiple of 16, then 3.3.1 would need to
reallocate more frequently, explaining the OP's performance
observations.

Don't know if this was actually the case; I'm just speculating.

cheers,
Mike


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