[osg-users] osg::DeleteHander - the good, the bad and ugly

Robert Osfield robert.osfield at gmail.com
Sun Sep 2 02:36:29 PDT 2007


HI Cedric,

I'm not sure what to make of your test.  The code doesn't really tell
me much more either.  The example code isn't quite testing like with
like either, as I can't see any boost code support for thread safe ref
counting.  In the OSG case it isn't switched on, but one can do it
very easily due to the mutex pointer in Referenced - this pointer is
checked before each ref/unref which is probably where there is a
difference in timing, the boost pointer in your example doesn't look
to have this capability.

The real test would be an thread safe ref/unref between atomic
reference counted and use of a mutex to make it thread safe.

Robert.

On 9/2/07, Cedric Pinson <mornifle at plopbyte.net> wrote:
> I tried a little brut test about smart pointer from osg and the similar
> approch in boost with instrusive_ptr
> here the result with the source code:
>
>  PROFILE_ROOT prt 100.00 glb 100.00 - time  31.785504 avg  31.785504
> ncall 1
>      osg_sm    prt   2.85 glb   2.85 - time   0.905553 avg   0.905553
> ncall 1
>      boost_sm prt   2.84 glb   2.84 - time   0.901856 avg   0.901856
> ncall 1
>      boost2      prt  23.95 glb  23.95 - time   7.611869 avg   7.611869
> ncall 1
>      osg2         prt  70.37 glb  70.37 - time  22.366193 avg  22.366193
> ncall 1
>
> Cedric
>
> Robert Osfield wrote:
> > Hi André,
> >
> > On 8/31/07, André Garneau <andre at pixdev.com> wrote:
> >
> >> FYI you might want to check the Boost::intrusive_ptr implementation (similar
> >> in concept to OSG's ref_ptr) as it is using an underlying implementation
> >> that does atomic reference counting (using CPU native Interlocked
> >> test/increments). Note that I'm not suggesting to use Boost, just to get
> >> ideas from this implementation.
> >>
> >
> > Thanks for the suggestion.
> >
> > I'm chasing bugs right now.  Could members of the community have a
> > look into this? i.e. the possibility of adding atmoic counts into
> > OpenThreads and ref_ptr<>.
> >
> > Cheers,
> > Robert.
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
>



More information about the osg-users mailing list