Boost logo

Boost :

From: Matthew Wilson (stlsoft_at_[hidden])
Date: 2003-11-17 14:49:29


> > [As a side question, is it true that Nicolai Josuttis was the
> > inventor of the technique?]
>
> Which specific technique do you have in mind?

Not the general principle of having the reference-count external to the
counted type, but the specific technique of having it a heap-allocated
(integer) instance. That seems, to me anyway, the essence of the shared_ptr,
and the bit that's conceptually beautiful (albeit potentially slightly
inefficient). I vaguely remember reading somewhere that it was Nicolai
Josuttis, and I just wanted to be able to give just attribution.

> Based on the results below, I assume that 4 & 5 do not support weak
pointers
> and probably use atomic integer instructions for the count updates?

Correct. They are simple implementations containing the ptr to the counted
type and the reference count.

Yes, they use atomic integer instructions in the multi-threaded builds.

> You may be interested in adding:
>
> 6. boost::intrusive_ptr

I would. I'd not seen this one.

Reading ...

... ah nice! It uses shims.
(http://www.cuj.com/documents/s=8681/cuj0308wilson/)

Cool. I'll give it a try.

[Seems like you guys in Boost have got just about every good idea I've ever
had already in there somewhere, just under a different name. I shall have to
try harder! :-)]

> 7. shared_ptr, but with #define BOOST_SP_USE_QUICK_ALLOCATOR

Ok. I'll try that.

> 8. shared_ptr, but with detail/shared_count.hpp replaced with
>
> http://www.pdimov.com/cpp/shared_count_x86_exp2.hpp
>
> to the list.
>
> Would it be possible for you to share the source of the benchmarks?

Certainly. What would you advise: would it be ok to just send to you via
email, or do you want me to post the whole hideous heap here? There is a
certain amount of swill to be had.

1. There's a lot of STLSoft stuff in there, for the timings, and whatnot. (I
don't think that's swill, of course, but still there's a fair amount of
stuff needed)
2. There's a fair bit of very old, and *very* swillsome, Synesis code. If I
let you have it, you must promise not to consider it representative of
anything other than another lifetime, where both programmers and compilers
were a lot less intelligent.

I've just been distracted by some other stuff for a couple of days, but if
you advise as to whom/where to supply this, I will comply shortly

Cheers

-- 
Matthew Wilson
STLSoft moderator (http://www.stlsoft.org)
Contributing editor, C/C++ Users Journal
(www.synesis.com.au/articles.html#columns)
"You can tell a Yorkshireman, but you can't tell him much!" -- Uncle Michael
----------------------------------------------------------------------------
---

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk