This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch/rfa] Tiny but delicate change to string::_M_mutate
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Nathan Myers <ncm-nospam at cantrip dot org>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Sun, 17 Oct 2004 15:10:39 +0200
- Subject: Re: [patch/rfa] Tiny but delicate change to string::_M_mutate
- References: <4170164A.3070907@suse.de> <20041017061129.GE6452@tofu.dreamhost.com>
Nathan Myers wrote:
....... Probably the logic should still check for _S_empty_rep
to avoid touching its reference count:
Sorry, Nathan, I misunderstood you: you are actually concerned by bus
contention on *reading* _S_empty_rep's _M_refcount, *not* on writing it!
Luckily, it seems we can futher tweak my proposal to reduce it largely.
Just swap the conditional:
if (__new_size > capacity() || _M_rep()->_M_is_shared())
this way, when _S_empty_rep is concerned, we read _M_refcount *only*
when __new_size == capacity(), a not-so-common situation, compared to
the normal usage.
Paolo.