Expected performance of dynamic CompoundColliders?

Hi, so I’ve been running some experiments, here’s a little context: I have a project that’s highly ECS/DOTS based, but it requires a lot of changes to colliders. Making these changes in ECS, then piping them over to PhysX had been my performance bottleneck up till now so even though I know it’s early I thought I’d allocate a few days to try out unity physics.
I’ve really liked the API, but I’m seeing an issue with performance in my compoundcollider objects
Basically when this:

hits a static boxCollider my framerate tanks to 15FPS:

Using single non-compound colliders has no issue. I can spawn dozens of those with not even a bump in the profiler, it’s only when I make a compound object like this that I see problems.

I know in this case I could just be using one box collider for the whole thing, but it’s destructible, so I need to be able to add/remove cells from that compound collider on the fly.

PhysX handles this case…adequately. It struggles a little bit when complex compound colliders approach other complex compounds, but not on hitting a simple box collider, and not to this extent.

The creation process I’m using is something like this (chopped up for brevity obviously):

//....
NativeArray<CompoundCollider.ColliderBlobInstance> childColliders =
            new NativeArray<CompoundCollider.ColliderBlobInstance>(identifiers.Length, Allocator.TempJob,NativeArrayOptions.UninitializedMemory);
   
        new CreateShipUnityColliders()
        {
            cellSize =  cellSize,
            childColliders = childColliders,
            identifiers = identifiers,
            indicies = indicies,
            wallCollider = UBoxCollider.Create(new BoxGeometry(){BevelRadius = 0,Center = float3.zero,Orientation = quaternion.identity,Size = cellSize},CollisionFilter.Default),
            floorCollider = UBoxCollider.Create(new BoxGeometry(){BevelRadius = 0,Center = new float3(0,-cellSize.y/2f,0)
                ,Orientation = quaternion.identity,Size = new float3(cellSize.x,.1f,cellSize.z)},CollisionFilter.Default),
            COG = COM
       
        }.Schedule(identifiers.Length,64).Complete();
        var ncollider = CompoundCollider.Create(childColliders);
        childColliders.Dispose();
        var colliderComponent = new PhysicsCollider { Value = ncollider };
        entityManager.SetComponentData(entity,colliderComponent);

//....
public struct CreateShipUnityColliders : IJobParallelFor
{
   //....
    public void Execute(int index)
    {
        childColliders[index] = new CompoundCollider.ColliderBlobInstance
        {
            CompoundFromChild = new RigidTransform(quaternion.identity, new float3(indicies[index].x*cellSize.x, 0, indicies[index].y*cellSize.z)),
       
            Collider = identifiers[index] != uint.MaxValue ? wallCollider : floorCollider
        };
    }
}

(EDIT: ok, so I’m fairly certain this is a bug, as on further testing, this slowdown only occurs upon the FIRST dynamic compound body touching my static ground collider. I can spawn literal OODLES of these complex compound colliders, and after the first one, there’s absolutely no significant performance hit. Has anyone else had this problem with a first collision slowdown? Specifically with the NarrowPhase ProcessBodyPairs job hanging as pictured in the profiler above. I’m on the newest 0.2.4 unity physics version)

(NEVERMIND SEE EDIT ABOVE)
TL;DR questions:

  1. Are compoundColliders with many children a case that is performing well for others, and I’m doing something wrong with the setup?
    2. Are compoundColliders with many children a case that will ever perform well in UnityPhysics?
    3.How many child colliders should I be able to put in a dynamic compoundCollider object in unityPhysics and expect it to be performant? (I know it’d be more performant to absorb these box cells into larger convex shapes, but at what point should I expect to hit that upper limit of complexity?)

I’ve seen another post about compound colliders with hundreds of thousands of children performing at 100fps ( Unity 2019.2 DOTS Physics Test: 343k Compounds Cubes ), but in his video I didn’t see it colliding with anything, guessing it was only raycasts?

Anyways,thanks for taking a look.

Hi, the job has not yet been Burst compiled when you see it being slow - you can tell by it not having the “(Burst)” suffix in the profiler. If you enable synchronous compilation you will see it fast the first time too.