Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug (Case 1203866) Performance issue with EditorLoop

Discussion in '2019.3 Beta' started by YuriyVotintsev, Dec 8, 2019.

  1. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    93
    EditorLoop with nearly empty project takes 13-19ms, so even simplest code at decent configuration of PC can't run at 60fps in editor. When enabling deep profile it shows that it is something related to UIElements update and rendering.

    Profile1.PNG Profile2.png Profile3.png
    This is profile images.

    Maybe I should enable/disable something in settings?
     
    bjarkeck likes this.
  2. Cards

    Cards

    Joined:
    Jul 11, 2012
    Posts:
    1
    I'm getting the exact same issue. Running in a (nearly) empty project, simply moving a character sprite results in heavy choppiness with the same profiler stack trace.
     
  3. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    126
    I have same problem. EditorLoop takes about 10ms and spikes to 30ms.
    editorloop-spikes.jpg
     
    darman77 likes this.
  4. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    165
    Does this happen only when the profiler is running? I had some horrible editor performance when the profiler was running on a UI heavy scene. I solved it by turning of "UI Details" in the Profiler Modules drop-down.
     
    MartinTilo and Peter77 like this.
  5. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    93
    No, not only, i started to profile because i see stuttering and visual fps drops.
     
    darman77 likes this.
  6. Lopost

    Lopost

    Joined:
    Aug 10, 2017
    Posts:
    5
    I do have same problem here...
     
  7. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    126
    Little update. I have this issue even when profiler window is closed, but if I enable VSYNC on game view from that resolution dropdown (I have set vsync 'don't sync' on quality settings), it fixes that issue and everything runs smoothly.
     
  8. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
  9. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    looks to me like you have Game and Scene view open at the same time. So basically the same content needs to be displayed twice, from two different perspectives, all with the entire view and it's buttons and settings needing to be processed. If you dock Game and Scene view into the same docking area of the editor, so you'll only ever see one, you'll get better performance during Playmode.

    Those spikes on the other hand very much look like the Profiler Window getting repainted every couple of frames. To take those out of the equation, we introduced the Menu option Analysis -> Profiler (Standalone Process). That is not just a bandaid for bad performance of the Profiler Editor Window performance either, we are constantly working to make the Profiler Window impact to be lower (more performant, profiling costs less intrusive), but more a way to avoid recursively deep profiling the Profiler Window itself when targeting the Editor, too.

    You can also Profile data with the window closed (it will continue gathering data in the background), hitting F9 (Shortcut introduced in 2019.3 to toggle Recording state) or by profiling to file using Profiler.logFile .enableBinaryLog and .enable (example in the link).

    Finally, separating the Playmode execution from the surrounding Editor is currently nigh impossible but efforts like LiveLink aim to eventually offer similar iteration speeds while separating Player and Editor executions more fully. Until then (and probably even with it, though less so), the best way to check the performance you'll have finally is to make a build and run it on your target platform, attaching the Profiler to it for details. Find issues this way, then profile in the editor with the methods described above for better iteration workflows, but take all data with a grain of salt and staying focused on what you discovered in the build.

    Also, @Peter77 's advice on the Interaction mode and @MasoInar 's hint on the game view's vSync setting could also be beneficial to follow up on.
     
    Peter77 likes this.
  10. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Also, the issue found on our side in investigating the bug report was related to EditorStyles.UpdateSkinCache and fixed as a 2019.3 regression. Overall the performance of this scenario doesn't seem to have changed much beyond that regression over the last Unity versions (back to 2017.4), even if the public info on that bug report is admittedly not great and a bit confusing on that topic...
     
  11. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    93
    Yes, I have Game and Scene view open at the same time, but i did it since Unity 3. And never it was an issue for me before Unity 2019.3. (I skipped 2019.2 so i don't know if this was an issue there).
     
  12. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    93
    This advices didn't work for me. Performance of editor didn't changed. Maybe it is because i have changed monitor to 165hz and now Editor Updates happens 3.3 times more frequently? If this is the reason - then there should be setting to update less frequent than monitor refresh rate.
     
  13. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    That's probably it. You should be able to switch it to "Custom" and specify a reasonable update rate.
     
    MartinTilo likes this.
  14. Lopost

    Lopost

    Joined:
    Aug 10, 2017
    Posts:
    5
  15. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Did you try setting it to anything else and fiddle with the Custom delay?
    It could be you are encountering a genuine bug there that needs your Project, some Editor code in it or specific hardware to trigger. In that case it'd be super valuable to us if you could file a bug report so that we can address that, because it's obviously not ideal and not in our interest to have an LTS version regress in performance like that and essentially forcing people like you to downgrade (or revert the upgrade back to) to a 2 year old LTS that is about to laps out of the 2 year support window.

    If it is something that specific that we're not aware of, not having any bug reports on that would mean this might not get fixed until you're eventually forced to update (because e.g. that support window runs out and you are facing blocking issues or need a newer platform SDKs...) so it is likely not in your best interest not to report this either...

    @YuriyVotintsev did you try the Custom option and tried different values? Cause that kinda refresh rate would try to push a new editor frame every 0.006ms which would essentially be the same as No Throttling...

    Update: sorry, my math brain failed me on this one. That'd be 6ms and still having a throttling effect... Still worth exploring the Custom option to see what happens.
     
    Last edited: Jul 24, 2020
  16. Lopost

    Lopost

    Joined:
    Aug 10, 2017
    Posts:
    5
    I sent a report (Case 1264318 - you can examine) but we were not able to reproduce the issue. I tried 2019-2020 versions in both macos 14.6 and windows 10 and four of them was struggling with the exact same issue that I attached screenshot here. If you do a quick research on "Editorloop Problem" term in a search engine, you would easily find considerable number of the same issues.

    All in all, I need to make progress on my game, and after all I decided to downgrade my version.

    Forgot to mention, I also did my testings in a fresh project and a fresh scene.
     

    Attached Files:

  17. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Thanks, I looked over the report. The Spikes you encountered in an Empty Project look very much like the Profiler Window itself getting repainted, which doesn't sound like your original problem at all.


    yeah, sadly that's a pretty pointless endeavor as this is way to vague and could caused be any number of things. EditorLoop is just a black box until to toggle on Profile Editor (in Unity versions pre-2019.3) or since 2019.3, change the Profiler Target from "Playmode" to "Editor". Believe me, I know this is confusing and frustrating, even our QA sometimes falls into that trap (which is why your bug got falsely attributed as a duplicate. I detached it again and am working it out with our testers).

    Further ways to get closer to the root causes of such behavior is to use the Standalone Profiler available in 2020.1 or it's less fortunately named, WIP predecessor "Out-Of Process" profiler, that is already available in 2019.3 if you switch to internal mode.

    Please Make a backup before following these steps and be sure to exit internal mode again before you leave the Editor!
    1. Go to
      Help->About Unity
      and type "internal" with that window in focus (repeating the same exits internal mode again)
    2. Go to the Preferences, find the Profiler settings
    3. toggle on "Out Of Process Profiler (experimental)"
    4. close Profiler Window if open
    5. Hit CTRL/CMD +7 or open the Profiler regularly:
    6. -> Same thing as the Standalone Profiler, just an uglier name
    You can technically exit internal mode while using the Standalone Profiler be repeating step 1. However, I'd advise you to disable the "Out Of Process Profiler (experimental)" option and exiting internal mode before closing the Editor. Or if this crashes (it is internal/experimental for a reason after all), reopen the project first, uncheck the option and exit internal mode again, before opening any other project or editor version.

    that is very fair. However, I hope that this information on how to profile the Editor may come in handy to you or anyone else at some point now or later though.
     
  18. MartinTilo

    MartinTilo

    Unity Technologies

    Joined:
    Aug 16, 2017
    Posts:
    2,460
    Alternatively you can also avoid the Profiler Window overhead by keeping it closed and starting and stopping the Profiler with the F9 shortcut to toggle recording, then open the profiler.
     
    andreiagmu likes this.