New STL implementation from SGI

Nathan Myers ncm@cygnus.com
Fri Jul 10 16:49:00 GMT 1998


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



More information about the Gcc mailing list