I have a processing game where I am having serious lag problems with collision detection. I am using the most effective code I can think of however after about 9 levels in The game gets unbearably laggy. I would show you the code but site wont handle my less thans.
If you want to check the program out you can find it here: https://www.khanacademy.org/computer-programming/tanks-v1245/6637554186715136 under the tankMelee function ~line 160