Search Unity

Why is Unity's profiler so slow and unresponsive in a frame that has a lot of data?

Discussion in 'Editor & General Support' started by CanisLupus, Jan 3, 2016.

  1. Alloc

    Alloc

    Joined:
    Jun 5, 2013
    Posts:
    241
    I know that 2018.1 is meant to be the first 2018 version, but what I wanted to know was if this stuff was currently planned to go into 2018.1 or a later release ;)
     
  2. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    Sorry for that, it was probably overstatement. At that time we didn't have resources to fix the issue.

    Talking about exposing data format or public reader API, no, I don't think these can make it to 2018.1, unfortunately.
     
    Peter77 likes this.
  3. dCalle

    dCalle

    Joined:
    Dec 16, 2013
    Posts:
    55
    Hey, still got the Issue and I don't what is happening in the background...

    The profile probably has its own thread, i get it, but how is this tree saved?

    Opening a folder shouldn't be such an issue, and then, there are only a few values presented. So what's the big deal?

    I can figure, that cascading and recalculating a share, or adding up gc the tree is cost intensive, but which maniac would do that?
    What about a stored Tree, that does all the calculations ONCE you look into it. reduced to the info needed instead f probably picking data at request time and filtering it with the given settings.

    I have opened 24 branches and still haven't gathered any useful information yet, but wasted 10 minutes. The Editor is at the brink of collapse, BECAUSE I AM INTERACTING WITH A DIRECTORY TREE. what is this? Windows 3.1?

    Thank GOD Unity has an Asset Store.
     
  4. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    The issue with slow hierarchy view is fixed in 2018.1 which is in beta now, do you see it there?

    The tree is lazy constructed when a level is expanded from a flat raw data. Performance issue was more related to a visualization.

    We do a full traversal only once to get all accumulated stats.

    You should be able to expand millions of samples in 2018.1
     
    Peter77 likes this.
  5. dCalle

    dCalle

    Joined:
    Dec 16, 2013
    Posts:
    55
    alright thanks champ. am looking into it. sry for the outbreak ;-)
     
  6. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    I understand the feeling. When you are profiling e.g. entering playmode with deep profiling on a big project or just game update, hierarchy window in profiler is unusable...
    So we listened, profiled it and migrated to a new TreeView class which handles scaling much better.
     
    SugoiDev and dCalle like this.
  7. NoobCoderFake

    NoobCoderFake

    Joined:
    Nov 24, 2015
    Posts:
    42
    Is it possible to make a pair of method like this:
    Profiler.BeginDeepProfile("name")
    //Deep profile enabled
    Profiler.EndDeepProfile()
    since we just need this work on some specific code.
     
  8. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    No. Currently deep profiler works through a mono callbacks which involve domain reload to regenerate machine code for the functions with a profiler call injected.

    You can try to do the opposite - disable profiling when entering playmode (with Profiler.enabled = false;) while deepprofiling is enabled and enable it only for the particular code segment:
    Code (CSharp):
    1. Profiler.enabled = true; // Effective immediately
    2. // Code
    3. Profiler.enabled = false; // Effective immediately
     
    marcospgp likes this.
  9. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,336
    Is there a way to check through script if deep profiling is enabled? Can't find anything in the docs.
     
    alexeyzakharov likes this.
  10. alexeyzakharov

    alexeyzakharov

    Joined:
    Jul 2, 2014
    Posts:
    507
    There is undocumented (read it as exposed internal) API - UnityEditor.Profiling.ProfilerDriver.deepProfiling which returns true if deepprofiling is enabled.
     
    marcospgp, NoobCoderFake and Peter77 like this.