UnityGeometryGraph icon indicating copy to clipboard operation
UnityGeometryGraph copied to clipboard

Optimize geometry conversion code

Open TeodorVecerdi opened this issue 4 years ago • 0 comments

I tried to optimize the code at the expense of some readability, but it's still quite slow. It might be worth looking into https://docs.unity3d.com/Manual/JobSystem.html and refactoring code to work with that. The biggest performance hit comes from a big nested loop that should be easy to parallelize.

Performance breakdown:

  • GetDuplicateEdges: 66.2%
    • Self: 32%
    • List.get_Item: 15.8% (8,297,838 calls)
    • VectorUtilities.DistanceSqr - 12.8% (5,528,820 calls)
    • List.get_Count: 2.6% (1,385,660 calls)
  • RemapDuplicates: 18.6%
  • RemoveDuplicates: 3.3%
  • RemoveInvalidDuplicates: 0.7%
  • GetDuplicateVerticesMap: 0.3%

TeodorVecerdi avatar Sep 08 '21 15:09 TeodorVecerdi