Performance issues


I’ve integrated p2.js into a project - and immediately started to notice terrible performance issues. So I did a small test project to demonstrate:

In this test - I am directly setting the velocity - however, the performance issues remain to varying degrees, not matter if I use applyForce, or even if I disable the physics body, and directly move the character.

The symptom is that every now and again, you get a large skip in the character movement - and you can see that there is a very large DT passed through.It’s particularly pronounced on iPhone devices, but seems to occur on other devices.

Any help would be appreciated.

Is there anything in the profiler that stood out? Eg Garbage collection?

Yes, there was a large spike in garbage collection that generally accompanied the dt spike. I could not see where it was coming from however.