<p dir="ltr">Hi Jannik,</p>
<p dir="ltr">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. </p>
<p dir="ltr">The 20% regression you've seen could qualify. Is this with a release build?</p>
<p dir="ltr">As general note, I suspect you are over using callbacks.</p>
<p dir="ltr">Robert</p>
<div class="gmail_quote">On 8 Jun 2015 17:16, "Jannik Heller" <<a href="mailto:scrawl@baseoftrash.de">scrawl@baseoftrash.de</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Robert,<br>
<br>
I tried my application using the latest trunk and didn't notice any functional regressions.<br>
<br>
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 <a href="https://github.com/openscenegraph/osg/commit/e967420323bb6e500425144cb305cf8060c1c515" target="_blank">https://github.com/openscenegraph/osg/commit/e967420323bb6e500425144cb305cf8060c1c515</a> .<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
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.<br>
<br>
Cheers,<br>
Jannik<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=63985#63985" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=63985#63985</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div>