Search Unity

Performance: What is ResourceManagement.Diagnostics.DiagnosticEventCollector doing?

Discussion in 'Addressables' started by chanon81, Dec 25, 2019.

Thread Status:
Not open for further replies.
  1. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    I've been optimizing my game using Unity's profiler to minimize allocations and script CPU usage.

    I've successfully eliminated memory allocations during normal frame Updates() that come from my own code.

    However UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.Update() is regularly allocating 1.3 KBs and taking up to 70ms frame time.

    upload_2019-12-25_18-18-32.png

    This is running on an iOS device built as Release development build.
    I am using Addressables 1.3.8

    What is it doing and how can I make it stop?

    Note: I have Send Profiler Events Disabled
    upload_2019-12-25_18-42-58.png
     
    Last edited: Dec 25, 2019
    DungDajHjep likes this.
  2. nekocon666

    nekocon666

    Joined:
    Mar 1, 2019
    Posts:
    1
    Code (CSharp):
    1. var handler = Addressables.InitializeAsync();
    2. CoroutineManager.instance.StartCoroutine(() =>
    3. {   Destroy(UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.FindOrCreateGlobalInstance().gameObject);
    4. }, () => handler.IsDone);
    You should try this )
     
    TJHeuvel-net and chanon81 like this.
  3. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    Aha! thanks, looks like that should kill it.

    Wonder why Addressable devs don't care about it though. This is needless CPU and memory allocations that could affect performance of every game that uses Addressables.
     
  4. cg-adam

    cg-adam

    Joined:
    Jul 30, 2019
    Posts:
    44
    Did this work for you @chanon81 ? I am interested to know what this process was / should be doing.
     
  5. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    Actually haven't tried it yet. Will report back when I do.
     
  6. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    They don't care because they never test it on actual games, only synthetic tests with imaginary performance targets.
     
    DungDajHjep and chanon81 like this.
  7. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Saying we don't care feels a bit harsh. In any case, we have a ticket in our backlog about the fact that we are still processing events even when event processing is disabled. We just haven't gotten to it yet because we have limited resources and felt other items in the addressables backlog were higher priority.
    I apologize if you've gotten the impression we don't care. We definitely do, and are doing what we can, with the resources we have, to continually improve the system.
     
  8. chanon81

    chanon81

    Joined:
    Oct 6, 2015
    Posts:
    168
    I'm sorry that I've been pretty harsh. I guess it would be great if Addressable team gets more resources as there seems to still be a lot to do.
     
  9. Robdon

    Robdon

    Joined:
    Jan 10, 2014
    Posts:
    141
    Ah, glad I found this post, just changed over from Resources to Addressables, and realized I was getting 1.3kb of garbage very often. :(

    I can confirm that the Destroy() snippet 'fixes' the problem, and now I don't get any garbage.

    After my first Addressables.LoadAssetsAsunc() has completed, I just do a:
    Destroy(UnityEngine.ResourceManagement.Diagnostics.DiagnosticEventCollector.FindOrCreateGlobalInstance().gameObject);

    Not the best solution I feel, but the only way at the moment I guess.

    @unity_bill don't suppose you can confirm if that is a 'safe' thing to do until you fix the problem corretly?

    Thanks, Rob.
     
    DungDajHjep, chriszul and chanon81 like this.
  10. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Still an issue sadly
     
    DungDajHjep likes this.
  11. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    I also have issues with these event collectors. (Unity 2019.4.11, addressable 1.16.1)

    I'm getting missing script references when loading addressable scenes.

    2020-10-07 11_04_42-Setting Sun Project - 2019.3 - Microsoft Visual Studio.png

    This seems to happen with objects marked as dontdestroyonload which, according to the docs, is something that you need to work around but I didn't make those singletons, it's from addressables.

    2020-10-07 11_04_15-Setting Sun Project - 2019.3 - Microsoft Visual Studio.png

    As you can see in the pic the addressable script doesn't seem assigned anymore in the inspector. So how do I solve this?
     
  12. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
Thread Status:
Not open for further replies.