From -4102952594703582060
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,25827c9ceb81badc
X-Google-Attributes: gidf78e5,public
From: herbs@cntc.com (Herb Sutter)
Subject: Re: string/cow/algorithm
Date: 1998/08/20
Message-ID: <35dc79ad.108635599@nr1.toronto.istar.net>#1/1
X-Deja-AN: 383097941
X-NNTP-Posting-Host: 209.89.87.103
Content-Transfer-Encoding: 7bit
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <35D9AE1C.7553@pratique.fr>
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
Organization: iSTAR internet Incorporated
Mime-Version: 1.0
Newsgroups: comp.std.c++
Originator: clamage@taumet


Nathan Myers <ncm@nospam.cantrip.org> writes:
> the reference-counted version is 
> *always* more efficient than the always-copying version.

This is true for code built for single-threaded use only. The
reference-counted version is almost always less efficient (usually by an
order of magnitude or two, literally) in code built for possible
multi-threaded use, even if a particular program that calls it happens to
be single-threaded.

If a string object can be shared across processes, then you could also
replace "-threaded" with "-process" everywhere in the above paragraph.

[I'm assuming you're talking about strings; I didn't see the original
post, only a quoted version.]

Herb

---
Herb Sutter (mailto:herbs@cntc.com)

Current Network Technologies Corp  2695 North Sheridan Way, Suite 150
www.cntc.com www.peerdirect.com    Mississauga Ontario Canada L5K 2N6


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




