You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two meshes not-closed and concave that collide: one is static and the other one is moved. The only special thing here is that I make a lot of small movements until I reach a sort of equilibrium. The static one is about 5000 vertices and 9700 faces. The moving mesh is about 4200 vertices and 8000 faces.
I am on the devel branch with the last commit being b8c5ab9a1acebc0504969d3c0a2cd95ed620bc89.
When I run my application in Intel VTune ("Bottom-up" tab), I see that a lot of time is spent only in memory allocations :
coal::overlap: 2,4 secs
malloc from EPA::reset: 1,3 sec
coal::details::getShapeSupport<0> (called by coal::details::GJK::getSupport): 0,6 sec
free from coal::ComputeCollision: 0,5 sec
When I step into coal with a debugger I see the same pattern that repeats very often:
1/ call to EPA::reset(0, tolerance)
2/ sv_store was empty so it's resized to 4 elements.
To me, calls from leafCollides lead to many small allocations of memory from EPA::reset that kill performance. Since sv_store is always sized to 4 elements, a fix may be to set it to a fixed size at build time and create its content on the stack. Another solution would be to let the user provide a memory allocator that would make a better job here than std::allocator. Currently, I have better performance with FCL 0.7.
The text was updated successfully, but these errors were encountered:
Hi @laguerreche,
You're right.
However, the problem does not come from EPA but from MeshCollisionTraversalNode.
EPA can't have a fixed sized sv_store because its maximum size depends on the max number of iterations of EPA (which is a user parameter, not known at compile time). sv_store is not of size 4.
This is fine for other pairs of objects because the ComputeCollision functor reuses the same EPA object, so a malloc occurs only once (first time calling operator() on the shapes).
However, for MeshCollisionTraversalNode specifically, an EPA object is recreated every time it calls leafCollides... So indeed, the EPA::reset malloc occurs everytime leafCollides is called.
I can't remember exactly why this is done, but I had marked to fix that that on my todo list:
I have two meshes not-closed and concave that collide: one is static and the other one is moved. The only special thing here is that I make a lot of small movements until I reach a sort of equilibrium. The static one is about 5000 vertices and 9700 faces. The moving mesh is about 4200 vertices and 8000 faces.
I am on the
devel
branch with the last commit being b8c5ab9a1acebc0504969d3c0a2cd95ed620bc89.When I run my application in Intel VTune ("Bottom-up" tab), I see that a lot of time is spent only in memory allocations :
coal::overlap
: 2,4 secsmalloc
fromEPA::reset
: 1,3 seccoal::details::getShapeSupport<0>
(called bycoal::details::GJK::getSupport
): 0,6 secfree
fromcoal::ComputeCollision
: 0,5 secWhen I step into coal with a debugger I see the same pattern that repeats very often:
1/ call to
EPA::reset(0, tolerance)
2/
sv_store
was empty so it's resized to 4 elements.The callstack is:
To me, calls from
leafCollides
lead to many small allocations of memory fromEPA::reset
that kill performance. Sincesv_store
is always sized to 4 elements, a fix may be to set it to a fixed size at build time and create its content on the stack. Another solution would be to let the user provide a memory allocator that would make a better job here thanstd::allocator
. Currently, I have better performance with FCL 0.7.The text was updated successfully, but these errors were encountered: