On 02/06/2016 10:05 PM, Phil Bouchard wrote:
But it's like comparing apples with oranges because shared_ptr is a smart pointer and block_ptr really is a memory manager there to replace the garbage collector.
The documentation is doing that apples and oranges comparison when it claims that the performance of block_ptr "is comparable to shared_ptr". Furthermore, that claim is questionable as the benchmarks show that block_ptr is slower by several factors. If the benchmarks are unfair, then you should design better ones. The presentation claims "Constant complexity O(1) for all operations". Looking at the code I can see several loops (e.g. release() or redir() in block_header) so destruction does not appear to be constant. I also have an unrelated comment about the documentation: the Reference section is very confusing. It lists lots of detail functions rather than the public API.
Unless the counter is intrusive but that's the thing because block_ptr abstracts all of this and it is much less confusing to the end developer. And I'm not sure how intrusive counters can deal with multiple / virtual inheritance.
Which intrusive counter are you talking about? Are you thinking of intrusive_ptr<T>?