box2d.ts
box2d.ts copied to clipboard
v1.0.1 significant performance decrease compared to v1.0.0
Hi, I have just updated my game backend to a newer version of box2d.ts and the performande dropped a lot. I do a lot of QueryAABB and fixture.synchronize calls for my game's needs. I noticed that Solve takes more CPU now and GC became more aggressive.
v1.0.0
v1.0.1

The game code is the same in both cases. The game is playable on v1.0.0, but on v1.0.1 heavy lags appear because the server can't output enough frames per second.
In this version, there was a change to b2Body:SynchronizeFixtures that uses the center of mass instead of the transform position. This may be causing the proxy AABB's to be updated more often. I'm not sure what might be causing the GC. I recall using for..of loops for iterating in some places; perhaps this is generating garbage. I'll have to look into it further. For now, you might consider switching back to 1.0.0.
https://stackoverflow.com/questions/18364175/best-practices-for-reducing-garbage-collector-activity-in-javascript
@flyover hi, FYI.
Did some digging. The biggest performance drop comes from moving the math stuff to Float32Array.