Here's the profiling data...
apply this change to osgclip.cpp:
Code:
diff --git a/examples/osgclip/osgclip.cpp b/examples/osgclip/osgclip.cpp
index 3b74bd2..b202e35 100644
--- a/examples/osgclip/osgclip.cpp
+++ b/examples/osgclip/osgclip.cpp
@@ -28,6 +28,8 @@
#include <osg/LineStipple>
#include <osg/AnimationPath>
+#include <osgViewer/ViewerEventHandlers>
+
#include <osgDB/Registry>
#include <osgDB/ReadFile>
@@ -136,8 +138,13 @@ int main( int argc, char **argv )
// run optimization over the scene graph
osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode);
+
+ for (int i=0; i<10000; ++i)
+ rootnode->addUpdateCallback(new osg::NodeCallback);
osgViewer::Viewer viewer;
+
+ viewer.addEventHandler(new osgViewer::StatsHandler);
// set the scene to render
viewer.setSceneData(rootnode);
Release build, Ubuntu 14.04 64 bit, g++ 4.8.2
In 3.2, the Update phase for this change takes 0.15ms.
In svn/trunk, it's 1 ms.
That's a factor 6 performance regression for the base cost of node callbacks.
You might think that 10000 callbacks is a lot. But callbacks are used quite
liberally all throughout the OSG, and it's not too difficult to reach that
number in a big scene with lots of skeletal animations, texture animations,
etc. The flexibility of callbacks available is IMO one of the biggest strengths
of the OSG, so it's in our best interest to make them run fast.
What was the rationale for unifying all callbacks under a common base class?
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63986#63986
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org