Closed pablomayobre closed 6 years ago
As requested by @Positive07 I will attach some data collected on the influence on memory consumption of the changes in the pull request.
The data is display in a tool of mine that collects (among other things) memory consumption using collectgarbage("count")
at some key-spots marked manually in my code.
The points "get collisions" (top, middle) and "get level collisions" (right) capture the memory consumption changes from the call to HC:collisions() (these two calls are for different HC-instances) (averaged over a few seconds worth of frames):
The memory consumption increase is noticably smaller.
Looks good. Very good, indeed. Thanks for the in-depth analysis and the fix!
GJK
allocates asimplex
table every time it's called, andclosest_edge
allocates many tables in theEPA
loop.This resulted in high memory consumption as seen by @pfirsich. Trying to fix this issue we both worked on a way to make the
simplex
andedge
tables static.Additionally the
table.insert
was slowing down the iteration so it was changed for a single loop that inserts both values.Feel free to squash the commits if needed