Never used YourKit. Does it work well with X3D and does it give information that's easily useful?
For instance,
env.getCanvas().get3DPeer().getTriangles()
and
renderLoop.getIterationsCount()
both provide information that is directly usable for optimization purposes without a lot of fuss. Similar utility would be:
public class DebuggingSingleton
{
public static final boolean DEBUG = Boolean.getBoolean( DebuggingSingleton.class.getName() );
}
onRenderLoopStarted()
{
node.getTriangleCount();
node.getVertexCount();
DebuggingSingleton.instance().monitor( node );
}
loopIteration()
{
Map<String,Number> nodeInfo = DebuggingSingleton.instance.getInfo( node );
this.maxBoundingSpheres = Math.max( nodeInfo.get( PickLibraryClass.BOUNDING_SPHERES_DEBUG_NAME ), this.maxBoundingSpheres );
...
DebuggingSingleton.instance().resetInfo( node );
}
onRenderLoopStopped()
{
print the results
}
This seems like a very easy, flexible way to add application-specific instrumentation to the library without incurring any penalties when it isn't used. All the memory is stored inside the DebuggingSingleton and all the blocks of code scattered throughout the system with
if( DebuggingSingleton.DEBUG )
{
perform an expensive diagnostic calculation
}
will get removed by the JVM because the static final boolean is false (one of the known JVM optimizations).
Methods that could be expensive would just need a Javadoc comment telling us that they are intended only for debug usage... or even an annotation

Examples that would fall into this category are: node.getTriangles() and node.getVertexCount() listed above. These would be hideously expensive because they would have to traverse the graph to answer the question, but they ought to be pretty easy to write. O(1) full graph traversal only when I'm debugging is fine as long as I understand what will happen if I read the Javadoc. Those who don't read the docs or ask questions get what they deserve
