Well not that I am completely satisfied with performance of collision detection I am off to collecting various collision resolution schemes and other stuff that comes with them (simulation integration schemes).How to use
Just click, hold and move mouse to spawn balls, rollover components to see hints about them Schemes I used here
Firstly my older code that dates back to my experiments with Ball World [link]
back in 2007
Back then it was too slow to see how unstable it gets sometimes.
Second scheme is Position Verlet, very simple and more stable then my code, still easily goes crazy at around of 1k or more balls. You can see nice Java example here [link]
I plan to add more schemes in future.
So far it seems that in such cases it is physics stability that becomes a bottleneck and not the performance
Also as I am lazy and it is a testing builds it contains a some of unnecessary code like system energy calculation that eats up performance. So it's not at its best in that sense.Update
Small change, tried adding other model but so far failed,
aside from that thought that it would be good to see how unsatisfied situation is. So added coloring to balls that shows how much penetrations by other balls they experience this frame. For Verlet it also represents how much energy is emitted by them this frame to push out those other balls