Hi Jannik,

A quick reply as I am replying on my phone. My intention was to introduce
the same technique as osg::Node::asTransform() to avoid the dynamic cast,
but only do this if there was a noticeable performance regression.

The 20% regression you've seen could qualify. Is this with a release build?

As general note, I suspect you are over using callbacks.

Robert
On 8 Jun 2015 17:16, "Jannik Heller" <[email protected]> wrote:

> Hi Robert,
>
> I tried my application using the latest trunk and didn't notice any
> functional regressions.
>
> However, I did notice a performance decrease in the Update phase of about
> 20%, compared to OSG 3.2.0. This had me a bit concerned, so I digged
> through the changes and found commit
> https://github.com/openscenegraph/osg/commit/e967420323bb6e500425144cb305cf8060c1c515
> .
> Since that commit, we now get *four* dynamic_cast's per frame and
> NodeCallback, which I suspect is causing the slowdown. Two dynamic_cast's
> are in NodeCallback::run, then another two in NodeCallback::traverse.
>
> Changing to the non-deprecated Callback instead of NodeCallback gives a
> slight improvement with now just two dynamic_cast's in Callback::traverse,
> but still isn't optimal.
>
> Ideally, the application should be able to decide on the level of safety
> vs. level of performance it needs. If a Callback is only intended to be
> used on Nodes, there is little point in dynamic_casting to Node every frame.
>
> I think I can workaround the casts by using a custom class derived from
> osg::Callback as the base class for all my node callbacks. Still, it's
> quite a peculiar situation that does affect all users of the OSG.
>
> I guess my question comes down to, are there any plans on optimizing the
> Callback code before a final 3.4 release? If you aren't convinced, I can
> throw together a repro case and some profiling data, but I think the impact
> of 4 dynamic_cast's per frame and NodeCallback should be obvious.
>
> Cheers,
> Jannik
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=63985#63985
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to