
On Mon, Mar 10, 2008 at 3:18 PM, Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote:
I see that shared_ptr is quite costly in multithreaded environments cause it would need DCAS, and thus uses a spinlock in cases where it is not available.
If you pass shared_ptr objects by const &, the refcount doesn't need to be updated. Move semantics would make things like inserting into std::vector<shared_ptr<foo> > not update the refcount too. Until then, in most cases you can use std::deque<shared_ptr<foo> > instead. Do you have specific use case which demonstrates that shared_ptr's refcounting is the bottleneck? If you do, you can post it here for discussion and/or a possible fix. -- Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode