Re:State of Multicore OCaml [pdf]
by toolslive on Thursday June 28, 2018 @01:16PM
(#17418754)
I don't think that 'slow' is the problem here: C++ developers use shared_ptr almost everywhere, which is just reference counting and hence slower than if they were to use a garbage collector (yes, there are garbage collectors for C++).
I think the problem is that the cost is unpredictable. They want absolute control over _when_ things happen.
[ Parent
| on HN ]
> C++ developers use shared_ptr almost everywhere
shared_ptr is rare in idiomatic C++ code, and is only used when you actually have a shared object, or need a cyclic data structure with no clearly identified root. I wrote plenty of modern C++ with not a single shared_ptr in it.
not only when, but where : a fairly common pattern is to have computations done in one thread, then once the computation is done and the thread starts another, the shared_ptrs (or any other kind of memory owners) are swapped in another thread and cleared there.