Hi Pjotr,

On 3 July 2014 13:13, Pjotr Svetachov <[email protected]> wrote:

> I also noticed when profiling a scene with a lot of AnimationPathCallback
> that dynamic casts make 1-2% of the total execution time (Visual Studio
> uses strcmp when doing dynamic casts it seems). Almost all of this comes
> from NodeCAllback::run and Callback::traverse. The question is are all
> those casts really needed to be dynamic? Also it should be possible to cut
> that in half by not inheriting from NodeCallback but directly from Callback
> for the osg classes, or will that break a lot of existing code?


The subclassing was done in the way it was to enable backwards
compatibility.

One way around the dynamic_cast<> is to add an asNodeCallback() etc.
implementation into the osg::Callback class, this I've used elsewhere in
the OSG such as osg::Node.  It has my plan to implement this from
osg::Callback and subclasses too but wanted to let the new implementation
settle before optimizing it.

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

Reply via email to