Search Unity

Bug Unity 300ms performance spikes on editor.

Discussion in 'Editor & General Support' started by kylekaturn, Aug 9, 2022.

  1. kylekaturn

    kylekaturn

    Joined:
    Feb 24, 2013
    Posts:
    20
    Recently , I'm having some performance spikes on editor.

    when I create empty project and play there is a serious performance hit(300ms) on every second as you can see in captured screenshot.

    profiler indicates MonoIO.Flush() takes 300ms, I have no idea what it is.

    And thing is, this spike is only happening while I grab & move any object is scene view. if I don't touch anything there is no spike.

    please help.
     
    Last edited: Aug 9, 2022
  2. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    What version of Unity are you using, and what platform? You say you enter playmode and then move objects in the scene view?

    It seems the PropertyDatabase used by Search is causing your issues as it tries to save on disk all the changes happening on the objects. This shouldn't happen, all changes to disk should happen on a background thread. This is clearly a bug. I will investigate further.

    Can you log a bug with the Bug Reporter with you test project, and add the following information:
    - This is related to Search's document invalidation. It shouldn't causes lag spikes due to file writes when moving objects in the scene view.

    If you log this bug can you also share the case number here? It will be easier for me to track it.
     
    lmbarns, angrypenguin and mancuso like this.
  3. kylekaturn

    kylekaturn

    Joined:
    Feb 24, 2013
    Posts:
    20
    I'm on Windows.
    and I tested multiple unity versions to reproduce the issue.
    here are what I got so far.

    2019.4.40 - not reproducible
    2020.3.38 - not reproducible

    2021.3.8 - reproducible
    2022.2.0 - reproducible
    2023.1.0 - reproducible

    now I'm trying to report bug. I'll post case number here as soon as i get.
     
    Last edited: Aug 19, 2022
  4. kylekaturn

    kylekaturn

    Joined:
    Feb 24, 2013
    Posts:
    20
    CASE IN-14383
    I just reported a bug!

    and I found out I gave you some misinformation
    the performance spike happening without entering playmode.
    It doesn't matter whether in playmode or not. it always happening
     
    Last edited: Aug 20, 2022
  5. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Thanks for the info and the bug!
     
  6. nikitadezhic_unity

    nikitadezhic_unity

    Joined:
    Mar 17, 2020
    Posts:
    7
    Has this been solved? Having the same problem in 2021.3.6.
     
  7. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    Hi! This issue was not solved. Our QA has difficulty reproducing the issue, so they have closed the bug for now. If you can provide more information to help us reproduce it, your are welcome to add any info to issue https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-14383. If you can't access it, feel free to create another bug and link it here.
     
  8. DragonCoder

    DragonCoder

    Joined:
    Jul 3, 2015
    Posts:
    1,701
    Is there never a check on whether that has completed, aka a "deadline" when the main thread is stopped until that task is finished?
    That's how background tasks are often designed, I believe.

    I'd suspect that the thread starters drive is regularly busy and just took so long that, in background or not, eventually led to those stutters. Would explain why it's not easily reproducible on other machines at least.
     
    lmbarns likes this.
  9. Metron

    Metron

    Joined:
    Aug 24, 2009
    Posts:
    1,137
    Sorry, but the fact that you have difficulties to reproduce a bug does not mean you can simply close it. Have you thought of getting in contact with those who have reported the bug and do a remote debugging?
     
    carking1996, Max-om, Ryiah and 3 others like this.
  10. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    After more investigation, we found that the issue is coming from the PropertyDatabase saving its backing file to disk on the main thread even if there is no need for it.

    The QA did reach out to the original reporter, but they did not respond. We are aware of the issue on our side and are going to fix it.
     
  11. nikitadezhic_unity

    nikitadezhic_unity

    Joined:
    Mar 17, 2020
    Posts:
    7
    UPDADE: the bug is abscent (at least for me) in 2021.3.14.
    UPDATE 2: false alarm, bug came back also in 2021.3.14.
     
    Last edited: Dec 2, 2022
  12. max_autious

    max_autious

    Joined:
    Dec 29, 2017
    Posts:
    9
    Can add that we are experiencing the same issue in our project on 2021.3.13, and its performance impacts are severe enough to negatively affect development in the editor.
     
  13. nikitadezhic_unity

    nikitadezhic_unity

    Joined:
    Mar 17, 2020
    Posts:
    7
  14. kylekaturn

    kylekaturn

    Joined:
    Feb 24, 2013
    Posts:
    20
    this issue was present until 2021.3.16f1 version.

    But I confirmed this issue resolved on 2021.3.17f1 version.

    altough there is no information regarding this issue in release note fixed list. but it is fixed
     
  15. sebastiengrenier

    sebastiengrenier

    Unity Technologies

    Joined:
    Jun 11, 2019
    Posts:
    96
    I'm not aware of any fixes we have done for this specific issue, but I'm happy to see it is fixed for you.

    However, improvements to SearchMonitor.InvalidateDocuments and the underlying PropertyDatabase are coming soon to 23.1, 22.2 and 21.3. They have already landed for 2023.2.0a1.