PATCH: _Atomic_swap implementation for g++-v3/bits/stl_threads.h
Dimitris Vyzovitis
vyzo@media.mit.edu
Thu Oct 4 19:59:00 GMT 2001
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
More information about the Libstdc++
mailing list