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]

Re: New STL implementation from SGI


Joe Buck wrote:

> > To decide which version we use somebody will have to make measurements
> > with a thread-safe version of either implementation.  My guess is that
> > the SGI version is faster since we don't have to care for locking.
> 
> Actually I suspect that the SGI version will be slower as well as require
> more memory in some applications: if copying strings from place to place
> is common, but concatenation is less common, a deep copy may cost more
> than a reference count adjustment. 

In particular, returning a string from a function will be substantially
more expensive.

> But other operations are faster
> (e.g. get the string length without any indirection, c_str() is free etc).
> Because of the different implementation tradeoffs, just tell me which
> implementation you want to win and I will write you an appropriate
> benchmark. :-)

Compared with the rewritten version, length() or c_str() should be about 
equally fast in either case. 

Nathan Myers
ncm@cantrip.org


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