On 11/21/10 7:59 PM, dsimcha wrote:
[snip]
Atomic: 258 milliseconds total (258 nanoseconds per iteration)
Non-atomic: 88 milliseconds (88 nanoseconds per iteration)
I think this is a small enough overhead that we should just make all reference
counting atomic. This would make the race condition pointed out by Michael
Fortin completely moot IIUC. It would also make it possible to safely share
reference counted containers across threads in shared/synchronized wrappers,
etc.
Thanks for taking the time to build a credibla baseline. A lot of this
depends on the perspective. We're looking at a 2.9x slowdown after all.
After discussing this with Walter, our conclusion was that we need to
solve the problem of calling destructors from a different thread in
general, not only for reference counting. The fact that you could have
arbitrary race conditions in destructors definitely is a problem, one
that needs a solution.
We currently think the solution should be that the GC guarantees
destructor calls in the same thread as the constructor.
Andrei