Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Feedback ETA of various performance optimization

Discussion in 'NetCode for ECS' started by optimise, Oct 4, 2023.

  1. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,029
    Currently at latest 1.1.0-exp. release, I still have the following performance issues profile from my project at android device i.e. Mi 9T Pro (Snagdragon 855) and would like to know when official is planning to address each item that it will fix at 1.1, 1.2 or later?

    1) Remove GhostInputSystemGroup system stalling caused by GhostUpdateSystem:UpdateJob. Expected to reduce around 1ms.
    upload_2023-10-5_0-57-55.png


    2) Batch build physics world system to update only once in 1 frame instead of multiple times. Expected to reduce around 0.6ms+.
    upload_2023-10-5_1-0-5.png


    3) Remove SolveAndIntegrateSystem stalling caused by BroadphaseSystem and also remove malloc. Expected to reduce around 0.8ms+.
    upload_2023-10-5_1-2-7.png

    4) Remove GhostCollectionSystem stalling caused by complete jobs I guess. Expected to reduce around 0.17ms+.

    upload_2023-10-5_1-5-23.png

    5) Remove PredictedSimulationSystemGroup stalling caused by complete job. Expected to reduce around 0.22ms+. See https://github.com/tertle/com.unity.entities/commit/3c81cc6e43780e1c55ba93b5cc6a0c285003cad5

    upload_2023-10-5_1-8-5.png
     
    Last edited: Oct 4, 2023
    mgear likes this.
  2. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    774
    Probably (potentially) maybe 1.2 or later.
    Fixing the stall for the ghost input system is kinda little hard to do (because of the job dependencies in updating the OwnerIsLocal component). But, if you are willing to accept the possibility that the flag is outdated of one frame (when it become true or false) then we just opt to move the GhostInputSystem before the GhostUpdateSystem.

    The SolveAndIntegrateSystem stalling is almost on physics and the way they do the successive rescheduling of jobs for the step.

    Batching rebuild physics world is in there radar.

    GhostCollectinSystem and PredictedSimulationSystemGroup are in the radar.
     
    optimise likes this.
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,029
    I see. The flag is outdated of one frame (when it become true or false) are u refer to GhostOwnerIsLocal component that sometimes will stay enable/disable late 1 frame? But since I not sure how impactful for this changes, can implement it as define like GHOST_INPUT_SPEEDUP so I can switch back and forth to test it?
     
  4. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,029
    Tertle fixed SolveAndIntegrateSystem and PredictedSimulationSystemGroup stalling but at editor there's netcode rpc error spamming needs to fix. Though player runtime build still working fine. I can try to submit a minimal repo if u want. Anyway I think official can merge this awesome improvement into official release together with error spamming fixed.
    https://forum.unity.com/threads/in-49838-1-0-11-massive-performance-spike.1467863/#post-9396932
     
  5. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    774
    It did not solve them, it hacked them by removing waiting for job completetion and put the burden at the end of the command buffer. I already fixed the stalling in the PredictedSimulationSystemGroup too long ago (just the PR didn't land yet).
    The SolveAndIntegrateSystem can be fixed, but requires change in Physics, and does not solve the inner problem of that loop either.
     
    Occuros and optimise like this.
  6. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,029
    Oh. I forget to tell u there are changes at netcode too. See https://github.com/tertle/com.unity.netcode. Are u doing similar changes?
     
  7. CMarastoni

    CMarastoni

    Unity Technologies

    Joined:
    Mar 18, 2020
    Posts:
    774
    Something in line IIRC. I will double check its fork