This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: New STL implementation from SGI
- To: egcs at cygnus dot com
- Subject: Re: New STL implementation from SGI
- From: Nathan Myers <ncm at cygnus dot com>
- Date: Fri, 10 Jul 1998 14:05:51 -0700
- Newsgroups: cygnus.egcs
- Organization: http://www.cantrip.org/
- References: <r2emvuki93.fsf@happy.cygnus.com>, <199807100002.RAA10346.cygnus.egcs@atrus.synopsys.com>
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