Performance improvements

this is my profiling result

http://img516.imageshack.us/img516/5279/profilingkm3.jpg



is it really necessary to crate new vectors? (cross/subtract)

the bounding box creates 0 bytes of garbage on an updatemodelbound-call.



also there are objects created in TrianglePickResults.addPick (one arraylist + trianglepickdata per call). for problems like collecting stuff per call, i recycle my lists and write "DO NOT REENTER THIS METHOD OR YOU WILL DIE" in the javadoc. maybe there is a way around these creations?

and more surprisingly, calculatedistance in TrianglePickData spams some vectors instead of using private static final ones or at least recycle the ones created like in many other places i've seen.



and, shame on you, i found this comment:

//XXX optimize! ugly bubble sort for now



if you optimizied any of these already just tell me and i'll re-profile the spots using the newest version from your cvs until they start to suck in garbage instead of creating it.


Well if you develop or performance test I strongly recommend using the CVS version.



Creating new vectors could probably be avoided fpor updateModelBound(), we should be able to reuse the current ones and we have "local' methods for most calculations. For triangle picks it's not that bad imho. If you're getting a lot of results there you already have bigger problems then object creation. calculateDistance sounds like it could be better though.



The XXX's are put there so people can find places that still need work… so… give it a try if you feel like it :wink:

You're just lucky you weren't using jME in 2004 :slight_smile:

Is this meant to be read "Trace those XXX's and fix them if you can" ?  :stuck_out_tongue: