Hi Tom, The ValueList in osg::Switch is a std::vector<bool> for readability reasons - it's obvious what it relates to. You report of using Switch nodes slowing performance is surprising - the first report of this issue in the history of the OSG project, so you are either more Switch nodes than anyone else, your compiler is now doing a very poor job at optimization or perhaps you're just a better detective and are the first to pinpoint the problem.
Is the performance slow down something you see under release build? Or so it'd look to be a real issue. The next step after this would then be to change the ValueList defined in Switch to std::vector<uint> and then do the testing again. As a general note, typically our cull traversals are bandwidth limited rather CPU limited, so using memory more efficiently and avoiding cache misses is more critical than local optimizations. Robert. On Fri, Sep 3, 2010 at 11:27 PM, Andrew Cunningham <[email protected]> wrote: > Hi, > I am looking at a performance slow-down introduced after using some > osg::Switch groups. > > I did some performance benchmarking on std::vector<bool> and I found > push_backs are 10x slower than std::vector<int>, and more importantly, the > simple [] operator is about 20x slower(*). I am not sure it is the smoking > gun yet, as I will need to back-track a lot of code, but it looks possible. > > This is because std::vector<bool> is specialized in the STL to be a memory > efficient packed vector. > > I am not so sure that the memory (<bool> vs say <unsigned char> ) saved is > really worth the performance hit in the case of osg::Switch > > (* Win32, _SECURE_SCL=0, Studio 2008) > > Andrew > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=31323#31323 > > > > > > _______________________________________________ > 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

