[osg-users] Would someone be willing to help me diagnose a performance issue?

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Tue Nov 10 13:45:30 PST 2009

Hello Frank,

> I'm not sure exactly what these numbers mean. 

You were on the right track. The Camera numbers are the objects that are 
not culled, and the View numbers are the objects that are in the view's 
scene, whether they're culled or not.

When you set a node's mask to 0, you're force-culling the node. The 
traversals (whether the update, cull or draw traversals) will visit the 
top node (that has its node mask to 0), binary-and that with their 
traversal mask, the result will be 0 so they will not traverse down into 
them. It's pretty cheap to test, as long as the node mask is really set 
on the root node of a whole hierarchy, and not on the leaf nodes 
(Geodes), because that would force the visitors to traverse the whole 
hierarchy only to find that at the bottom there's nothing to draw.

You modified the "quick app" to have the same object cache as the "slow 
app", but the numbers for the "quick app" with object cache are actually 
very similar to those of the "quick app" without object cache. So that 
suggests that all the objects you added to the graph (i.e. the object 
cache) are not being visited by the cull visitor, so they don't affect 
the stats.

Now, you need to examine why the numbers are so much higher for the slow 
app. Can you modify that one so that it doesn't load up as many objects 
into the object cache? Also, how many of the loaded objects are visible 
when you get those stats? And are the objects from the object cache 
really hidden by setting their root node's node mask to 0, or are they 
hidden by setting the node mask on some lower node in the hierarchy? It 
seems to me that some of the hierarchy of the invisible objects is being 
visited even if they're not being displayed.

The number of transforms (Matrices in the stats) and drawables seems 
pretty high to me for the number of vertices you have visible, so I 
really think there's something fishy in the way you're hiding the nodes.

If you analyze your graph, in the "slow app", you've got about 86 
vertices per drawable (straight division), and one transform per 
drawable. In the "quick app", you've got 217 vertices per drawable 
(again straight division) and again one transform per drawable. So in 
the "quick app" the geometry is batched better (but only slightly - 
vertices in the thousands or tens of thousands per drawable would be 
better on modern cards), and you've got a pretty flat graph (one 
transform per drawable), though that's pretty normal for a modeling tool 
(which is what I assume you're working on, or similar tool).

There's been much written on how to optimize the graph in the past, so 
for further reading you could search the archives on that subject. But 
you've got something weird in the "slow app" already, as I said above... 
My hunch is that the way you hide the nodes is different and not optimal.

Hope this helps,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list