Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: fishigon

26. May 2012, 04:11:26 pm
Xith3D CommunityGeneral CategoryGeneral Discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)default value for the pickable property
Pages: [1]
Print
Author Topic: default value for the pickable property  (Read 1998 times)
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« on: 16. February 2007, 04:23:44 am »

As you may know, the default value of the pickable flag (of the Node class) is false. When the Xith3DEnvironment is used, the default is true. Xith3DEnvironemnt simply switches the global default in the constructor. This can lead to confusion, when Nodes are created before Xith3DEnvironment is created (e.g. in a static block).

I would like to set this default generally to true. Nothing else makes sense as a default, since the Nodes of interest are preselected by the group, which is passed to the pick method. The pick methods either take a VirtualUniverse, or a GroupNode or a List<GroupNode> (or nothing, which default to VirtualUniverse). So you can easily minimize the tested Nodes.

Is everybody ok with setting the default pickable property to true?

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #1 on: 16. February 2007, 09:12:41 am »

Updating the default makes a lot of sense.  We have definitely have means to reduces the traversed nodes.  This will allow us to program following the "make it work easily and optimize it after proving there is a problem."  Along those lines, what means do we have or can you easily add (maybe 1 or 2 trace statements)  to allow us to see picking metrics so that we might know we accidentally traversed too many nodes?
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #2 on: 16. February 2007, 01:12:37 pm »

Along those lines, what means do we have or can you easily add (maybe 1 or 2 trace statements)  to allow us to see picking metrics so that we might know we accidentally traversed too many nodes?
That's hard to define how many is "too many". That's the problem of "mechanized" debugging...
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #3 on: 16. February 2007, 02:50:59 pm »

That's hard to define how many is "too many". That's the problem of "mechanized" debugging...

That's why I asked for a feature to provide counts or metrics of some kind to a human.  That way, we can inspect to discover what's taking the most time when we believe CPU is being consumed by picking code.
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #4 on: 16. February 2007, 04:07:17 pm »

That's hard to define how many is "too many". That's the problem of "mechanized" debugging...

That's why I asked for a feature to provide counts or metrics of some kind to a human.  That way, we can inspect to discover what's taking the most time when we believe CPU is being consumed by picking code.
Yeah, I plan to implement that soon in Xith3D.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #5 on: 16. February 2007, 05:20:45 pm »

That's why I asked for a feature to provide counts or metrics of some kind to a human.  That way, we can inspect to discover what's taking the most time when we believe CPU is being consumed by picking code.

I'm not sure, if I understand you right. But isn't this done by profiling tools like YourKit?

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #6 on: 16. February 2007, 05:58:55 pm »

Never used YourKit.  Does it work well with X3D and does it give information that's easily useful?

For instance,

Code:
env.getCanvas().get3DPeer().getTriangles()
and
Code:
renderLoop.getIterationsCount()

both provide information that is directly usable for optimization purposes without a lot of fuss.  Similar utility would be:

Code:
public class DebuggingSingleton
{
    public static final boolean DEBUG = Boolean.getBoolean( DebuggingSingleton.class.getName() );
}
Code:
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

Code:
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 Smiley  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 Wink
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #7 on: 16. February 2007, 06:18:24 pm »

Cool ideas about the triangles- and vertex count. I will implement that. But it is certainly not done in O(1) when invoked on a group, but in something like O(log n), if the graph was balanced, which it is not in most cases. So it is actually something between O(log n) and O(n).

YourKit doesn't give you information ala getTrianglesCount(). It gives you information about the what are the most expensive parts in your coding or where is the most GC produced. And much more. Sometimes the user interface is a bit strange. But it is a very cool tool.

Marvin
Logged
horati
Global Moderator
Getting respectable
*****
Offline Offline

Posts: 393


View Profile
« Reply #8 on: 16. February 2007, 06:31:39 pm »

My O(1) was referring to invocation count of the top-level call, not the internal count.  My O(1) isn't nearly as expensive as O(f) where f is a frame resulting in O( [ f log n, f n ] )  Grin  No matter how hideous the call is, I'm only calling it once and only when I'm debugging.

Ah, I see.  YK is a pretty standard profiler then.  For those most part, I think library users shouldn't have to deal with that level of detail unless they want to.  I'm a big believer in optimizing the really big stuff and letting compute power handle the rest.

For instance, the MultiCubeBenchmark convinced me I had to use fewer spheres because they involve so many triangles.  That alone produced a huge FPS boost for me so other than not doing completely stupid stuff I won't worry about performance until the next problem arises Smiley

I've never actually created a problem where I had to use a memory profiler to fix it.  I guess I'm careful that way.  My hard line regarding optimizing only that which absolutely needs it usually means I can get away with the profiler built into the JVM LOL
Logged

Kevin
"It may not seem like a big deal, but ignorance of character encoding issues leads to insidious code rot akin to y2k."
http://stackoverflow.com/users/3474/sylvarking
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #9 on: 17. February 2007, 02:59:34 am »

Now I understand you.

YourKit is more sensible for us API programmers. The users are more interested in information provided by such getXXXCount methods. But we can tune the API itself by using a tool like YourKit.

Marvin
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #10 on: 17. February 2007, 12:36:31 pm »

Now I understand you.

YourKit is more sensible for us API programmers. The users are more interested in information provided by such getXXXCount methods. But we can tune the API itself by using a tool like YourKit.

Marvin
Absolutely.

I think the debug tools I want to implement will be based upon the Scenegraph Tree. There will be probably several views, with one reporting the biggest objects (in polygon count)..

Also, why not make a detector of shapes which could be static (=using display lists) and aren't yet ? That'd be useful (otherwise users, would just go and say "wow, Xith3D is just shitty, I don't even get 500FPS Grin ).

Some "contextual development tips", to sum it up.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic