Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Performance degradation on a8 due to UpdateAllMenus (from the new MenuService)

Discussion in '2021.2 Beta' started by SugoiDev, Mar 12, 2021.

  1. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Just noticed a performance degradation with the new MenuService today:

    upload_2021-3-12_20-46-52.png


    My assembly reload times have gone up in about 1 second, consistently.
    Should this be a bug report?
     
  2. charlesb_rm

    charlesb_rm

    Joined:
    Jan 18, 2017
    Posts:
    485
    yes, this seems like a bad regression, please submit a bug report
     
  3. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    Done. Case #1321466

    Some extra data if others are trying to reproduce this as well: I have about 350 usages of MenuItem in my project (many of those are validators), and the time added is a bit over 1 second on every reload.

    On my reproduction case, I encountered the same numbers, roughly, so it seems to be consistent.
    Those numbers are from a Ryzen 3700x machine.
     
  4. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    Hi,

    I have notified the responsible dev about this. That said, before that time was spent in C++ and was not monitored in deep profile.

    Deep profile tend to report wrong numbers with higher iteration count. Could you install https://github.com/Unity-Technologies/com.unity.performance-tracking and report the
    UpdateAllMenus
    tracker without going into deep profile. You can see here that
    UpdateAllMenus
    takes around 1.1 ms which is reasonable. Deep profile traces are useful when you have something equivalent to compare it too, but not really when used independently. We recommend using
    ProfilerMarker
    or
    EditorPerformanceTracker
    in order to have a better picture of what is really happening.

    upload_2021-3-15_19-55-0.png
     
    mahdi_jeddi and SugoiDev like this.
  5. SugoiDev

    SugoiDev

    Joined:
    Mar 27, 2013
    Posts:
    395
    The trackers really do give a much better view.

    This is on my production project
    upload_2021-3-15_21-33-16.png

    And this is on the reproduction project I submitted to the bug report
    upload_2021-3-15_21-34-16.png


    Thanks!
     
    PutridEx and jonathans42 like this.
  6. jonathans42

    jonathans42

    Unity Technologies

    Joined:
    Jan 25, 2018
    Posts:
    514
    But clearly there is always room for improvement, even more when we've moved the code from C++ to C# so we will try to optimize the
    MenuService
    and gets back a few milliseconds we've might of lost in the process.

    Thanks for the feedback.
     
    Last edited: Mar 17, 2021