This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PATCH: _Atomic_swap implementation for g++-v3/bits/stl_threads.h
- To: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Subject: Re: PATCH: _Atomic_swap implementation for g++-v3/bits/stl_threads.h
- From: Dimitris Vyzovitis <vyzo at media dot mit dot edu>
- Date: Thu, 4 Oct 2001 22:59:10 -0400 (EDT)
- cc: libstdc++ at gcc dot gnu dot org
On Thu, 4 Oct 2001, Loren James Rittle wrote:
> Are the atomic operations from libstdc++ available and working on
> every platform that supports gthr? If so, I would have no problem
> changing the implementation to use the atomic operation abstractions
> (probably better to do so before we ever ship it in 3.1).
>
> My understanding is that Dimitris has a multi-threaded code base that
> he uses against the rope implementation. Perhaps, we could convince
> him to investigate the alternate implementation so that the first way
> it ships in gcc 3.1 is closer to optimal. OTOH, it should be noted
> that this only affects getting a C string reference to a rope string.
> Is that case worth the optimization (especially, if we have to add
> extra configuration paths)?
yes. What happened is that I started porting my codebase to
gcc-3 from 2.95 and rope-based code stopped compiling - then I simply went on
to fix the problem so that my code compiles again...
I wouldn't mind trying alternative implementations, but I am not sure it is
worthed the trouble.
rope::c_str() is only used for 'freezing' ropes, which is an infrequently
used and inherently slow operation (most likely used near the end of the
lifetime of the rope).
Ropes are good for manipulating large dynamic buffers (append is O(logn)
as opposed to O(n) for strings), but c_str() is O(n). I don't think that
optimizing the atomic-swap operation for an already slow (and infrequently
used) call will make any difference in performance.
-- dimitrix
mailto:vyzo@media.mit.edu