This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch/rfa] Tiny but delicate change to string::_M_mutate


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]