gcc-2.95 and SGI STL 3.2

Dima Volodin dvv@dvv.ru
Mon Jun 21 06:56:00 GMT 1999


On Mon, 21 Jun 1999 09:09:42 +0100 (GMT), you wrote:

>On 21 Jun 1999, Steinar Bang wrote:
>
>> The native g++ <string> uses refcounting.  The SGI STL <string> always
>> does a deep copy.
>
>I don't think refcounting actually helps much with strings -- you have to
>do a deep copy whenever the data is accessed anyway (even read: think
>'string s="str",t; char &c=s[0];').

Besides, in a multi-threaded environment, refcounting requires an extra
mutex, which has to be used for _every_ string operation and thus
introduces a very heavy performance penalty compared with a
straightforward implementation without shared data.

>Tim.

Cheers!

Dima


More information about the Gcc mailing list