[osg-users] Ready to tag OpenSceneGraph-3.3.8 dev release, please test

Jannik Heller scrawl at baseoftrash.de
Mon Jun 8 10:50:27 PDT 2015

Here's the profiling data...

apply this change to osgclip.cpp:

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;
+    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

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:

More information about the osg-users mailing list