Collision detection efficiency

Even without a profiler, you can find out if your collision detection code is the problem. Go to your collision detection method, comment out all the code, and just return false (or null or whatever if there’s a return value for no collisions). Then run the game and see if the problem happens again.

When I have choppiness problems, it’s usually the case that some of my images have suddenly stopped being hardware accelerated. You should probably look into making sure they’re accelerated. Does the choppiness start right after you load some images?

People always think that sort of problem is caused by the garbage collector, but that’s never been the case for me.

You profile your own screen drawing method by using System.nanoTime() at the beginning and the end of the method. You just need to output the time spent during the method to the screen. If it jumps tremendously when the choppiness occurs, then the paint method is the problem.

A profiler just tells you the total amount of time spent in each method, thread, etc. It doesn’t tell you anything about a method suddenly taking much longer than it had previously.

[quote=“fletchergames,post:21,topic:35883”]
It’s typically always the case for me.

Also bear in mind that although it might not be the GC at all to blame, by proving it’s not this you’ve eliminated it from your list of things to check.