Search Unity

Question Performance issues with Build Physics World

Discussion in 'Physics for ECS' started by Noctiphobia, Apr 30, 2023.

  1. Noctiphobia

    Noctiphobia

    Joined:
    Jun 9, 2021
    Posts:
    8
    I've been trying to figure out the performance issues for quite some time, without any success.
    I created around 60k entities - all of them are static and have simple colliders. There's only one object that they're actually able to collide with. This is networked, although again I'm not sure if this is actually relevant here.

    ServerWorld BuildPhysicsWorld takes around 70 ms, out of which apparently 45 ms is idle, 17 ms is AnalyticsJobs: PhysicsBodiesAnalyticsJob (whatever that is), and only 2.5 ms is Jobs:createRigidBodies (with everything else combined taking under 0.2 ms, and in some frames DispatchPairSequencer:RadixSortPerBodyAJob takes a few ms). Another 22 ms is in EndSimulationEntityCommandBufferSystem, almost all of that is idle too.
    In ClientWorld, BuildPhysicsWorld takes around 200 ms, with 133 ms idle, 52 ms on AnalyticsJobs: PhysicsBodiesAnalyticsJob, and 7 ms on Jobs:CreateRigidBodies.

    So, what is happening? Why is there so much idle time? What are those analytics jobs, is that debug info (that I could hopefully turn off, like I did with the integrity checks), or something actually needed? What can I do to make this actually work?
     
  2. alemnunez

    alemnunez

    Joined:
    Mar 15, 2023
    Posts:
    7
    Looks like PhysicsBodiesAnalyticsJob only happens in the editor and when the preprocessing symbol ENABLE_CLOUD_SERVICES_ANALYTICS is defined (it's guarded by
    #if UNITY_EDITOR && ENABLE_CLOUD_SERVICES_ANALYTICS)
    .
    I have been trying to remove that symbol so that those analytics jobs won't run, but couldn't find a way to do so. If anyone knows how to do that let me know. I don't need those analytics and the PhysicsBodiesAnalyticsJob is taking 2ms per frame and ruining the performance in the editor.
     
    PW_Avi likes this.