Search Unity

Huge spikes on the profiler caused by EndFrameTransformSystem

Discussion in 'Entity Component System' started by georgeq, Sep 14, 2018.

  1. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    At first I though it was some of my system causing the problem, then on the timeline I noticed that on every spike there was a call to GC.Collect on one of the worker threads and occasionally on the main thread as well, but as far as I know I'm not doing anything that generates garbage. I order to be sure I disabled my systems on the entity debugger, but the spikes continued, so I disabled all systems and the spikes went away. Then I started to enable one by one each system until I reached EndFrameTransformSystem, which made the spikes appear again, then I went to the hierarchy I could see it is indeed generating garbage.

    _efts1.png

    Empty scene and the only system working is EndFrameTransformSystem.

    _efts2.png

    As you can see on the screenshots I'm using 2018.3.0b1 but also happens on 2018.2.6f1 although is less notorious.
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    Expande hierarchy on second screenshot and show here please
     
  3. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Here it is:

    _efts3.png
     
  4. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    You have many ISharedComponentData in you system?
     
  5. mike_acton

    mike_acton

    Unity Technologies

    Joined:
    Nov 21, 2017
    Posts:
    110
    Yes, will be fixed up once I couple of dependent things get resolved first.
     
    Deleted User likes this.
  6. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    No, and even if I would the only system enabled is EndFrameTransformSystem, no other system is running. You can see it yourself on your own project: Create a new empty scene, hit play, go to entity debugger, disable all systems except EndFrameTransformSystem, open the profiler and watch.

    Thank you!.. just take into account same thing happens with EndFrameBarrier.
     
  7. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    In my project with sufficiently heavy systems (2018.3.0b1 nd on 2018.3.0b2 too, ECS package preview.12) all works fine without any GC spikes. Only my own CPU spikes, when I do manual render on second camera for specific features.
    upload_2018-9-14_21-32-54.png
    upload_2018-9-14_21-36-52.png
     
  8. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    No idea why this happens. I have an empty scene and except for EndFrameTransformSystem it's completely idle, yet I see spikes at regular intervals.
     
  9. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    Just wonder, did you try restart Unity?
    If I keep unity for a while, it has some memory leak. Then it slows down.
    Can bee felt after few days of running.
     
  10. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    662
    Yes I did, but that doesn't solve the problem.
     
  11. maikramer

    maikramer

    Joined:
    Jun 2, 2017
    Posts:
    12
    Having the same problem, i have ecs included in the project but i'm not using yet.
     
  12. Deleted User

    Deleted User

    Guest

    Hello mike. May I ask, are you planning to fix the issue soon? Because the spike is huge.



    Thank you.
     
  13. marklama

    marklama

    Joined:
    Dec 7, 2016
    Posts:
    1
    Hi

    I just updated to Unity 2018.3f02 using ECS 0.0.12 preview 21 - this problem has come back in a massive way. I'm not only getting large spikes in performance every few seconds (80-100ms spikes), with lots of garbage collection but also the profiler is periodically freezing every few seconds, roughly coinciding with the performance spikes. This happens on EndFrameTransformSystem (GatherUpdateChunks) even when there are no entities in the scene (i.e. a blank scene). When the main scene is used, it appears at different systems - always relating to the GC - which EndFrameTransformSystem is creating a lot of.

    I'm assuming it was previously fixed as we didn't notice it in 2018.2.18. I have reverted back to 2018.2, as the new version is currently unusable.

    thanks
     
    Deleted User likes this.
  14. Deleted User

    Deleted User

    Guest

  15. sol-linux

    sol-linux

    Joined:
    Jun 10, 2015
    Posts:
    1
    Try to turn off leak detection (in Jobs->Leak Detection (Native Containers). Notice that this feature automatically turns on when you hit play button.
     
    marcuslelus, bricolage and TSWessel like this.
  16. dudleyhk

    dudleyhk

    Joined:
    Sep 27, 2017
    Posts:
    14
    Hey @mike_acton is there any update regarding this issue? Thanks :)
     
    spaceemotion and learc83 like this.
  17. zylo01

    zylo01

    Joined:
    Jun 28, 2013
    Posts:
    2
    I had a similar problem with consistent lag spikes, even in a new empty scene. After experimenting I discovered a solution/workaround for my case at least. Try enabling the "use incremental GC" function. You can find it in: Edit>Project Settings>Player>Configuration>Use incremental GC.

    It does not seem to solve the problem of accumulated garbage, but it seems to manage it better. I can still see where the spikes would occur, but they are flattened over multiple frames so that there is no noticeable frame drop as far as I can see.

    hope it helps
     
    NT_Ninetails likes this.