Hi Tugkan,

On Mon, Dec 8, 2008 at 11:04 AM, Tugkan Calapoglu <[EMAIL PROTECTED]> wrote:
> With printf's I ensured that the mutex code was not called in ref() and
> unref(). Here are the results (removed printfs before measurement :) ):
>
> No ref_ptr : ~1.15 ms
> ref_ptr but thread safety off : ~1.35 ms
> ref_ptr with thread safety on : ~1.65 ms
>
> I was focused on cull so I didn't write down what happens with draw.

What are model are you measuring for the above results, it seem like
very short cull times, and not worthy of optimizing, so I presume this
is for a very small test case.  If the performance looks like it's
going to break frame then worry about it, so in that vain could you
try throwing at the system a model that breaks frame/or near breaks
frame due to cull.

> I made these tests with SVN revisions 7327 and 7328 so things may be
> different now. But using pointers instead of ref_ptr seems to be better for
> performance.
>
> What kind of restrictions would using c pointers require?

The danger in using C pointers come from when you are running the
DrawThreadPerContext/ CullThreadPerCameraThreadPerContext threadings
model dynamically removing StateSet and Drawables from the scene
graph.  This threading models are allow the draw thread to overlap
with the update, event and cull traversals of the next frame, so it's
possible to modify the scene graph in a way that deletes objects that
are still being drawn which results in a crash.

A follow up problem can occur once you exit the frame loop, as you may
delete the scene graph before the draw threads have completed the last
draw traversals.

Since the OSG is used in some many different types of applications we
need to make sure the defaults are robust across a wide range of usage
models, so in this case the ref_ptr<> in the rendering backend is
essential.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to