Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Feedback 2020.2: Deleting assets inside Unity is significantly slower than deleting them via Windows Explorer

Discussion in '2020.2 Beta' started by Peter77, Aug 30, 2020.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,650
    During the 2019.3 beta phase I reported that deleting assets inside Unity is significantly slower than deleting them via Windows Explorer.

    Today I tested whether the same holds true with Unity 2020.2.0a21.



    Results
    • Windows Explorer = 2 seconds
    • Unity 2020.2.0a21 = 6 seconds
    • Unity 2019.3.0a8 = 12 seconds (taken from this video)

    Conclusion
    Deleting assets performance improved significantly compared to Unity 2019.3. However, it continues to be significantly slower than deleting the files in Windows Explorer as well.

    Thumbs up for the improvement compared against 2019.3, thumbs down for still being slower than Windows Explorer. :)
     

    Attached Files:

    • test.zip
      File size:
      15.2 KB
      Views:
      393
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,371
    Does the windows explorer measurement include the time it takes for Unity to import assets when you switch back to Unity after deleting in Explorer?
     
    Peter77 likes this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,650
    Nope, it does not. According to my other test, it would be +1.5 secs worse case for the asset database refresh.
     
  4. slime73

    slime73

    Joined:
    May 14, 2017
    Posts:
    107
    That's kind of comparing apples to oranges - AssetDatabase.Refresh is the top level call for many different sorts of work Unity does to synchronize its internal asset database with your files. The actual work will differ depending on what's changed (if no files have changed, the time taken by Refresh may be drastically different from if a file was added, which may take a different amount of time compared to if a file has been deleted).

    Neither your windows explorer measurement nor your other test you linked includes the time taken by Unity to refresh its asset database after a file is deleted, whereas the measurement where you delete a file through Unity's interface does.

    The comparison numbers only tell a small part of the story and are kind of misleading without including the refresh time after deleting an asset through Explorer - having that number separate from the Explorer number (e.g. "2 seconds in Explorer, 3 seconds in Refresh" or whatever) makes sense though.
     
    ImpossibleRobert likes this.
  5. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,371
    That's a database refresh for creation, though.

    I get that deleting the asset in Unity has to take longer than in Explorer, as Unity also has info about the asset in the library that has to be cleaned out. If the performance is that much worse, it might be that the cleanup is happening one-by-one instead of all at once. Or something like that.
     
    Singtaa and LeonhardP like this.
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,299
    I just want to add some info about this case: we looked into it and we know why it’s slower.

    We issue some commands to the OS once per file, such as copies and deletes. But on some OSs, there are functions to allow asking for multiple files to be deleted/copied all in one command. We don’t make use of this (but we should!)

    This accounts for the huge time difference between doing the operation in Unity vs Windows Explorer.

    It would be a bit of a rewrite to fix this in Unity, which is why it’s not been fixed yet, but hopefully it will be done at some point.

    The AssetDatabase.Refresh stuff is also relevant, but it’s only a small factor compared to the issue of submitting the commands one file at a time.
     
    senkal_, Singtaa, LeonhardP and 9 others like this.
  7. gekidoslair

    gekidoslair

    Joined:
    Sep 7, 2012
    Posts:
    128
    Just upgraded a project to 2022.2.12 and deleting a single file now takes a ridiculously long time - I hadn't noticed this until upgrading from the 21 LTS to 22.

    So...things are not getting better on this front it doesn't seem ;{
     
  8. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    218
    Even worse on 2022.3. Deleting a simple file or even an empty folder sometimes freezes the editor up for 20 seconds.
     
  9. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,650
    Yes, I have the same issue with 2022.3 and it's a fast PC that I have where the project is stored on a SSD.

    I believe those long freezes are mostly the first time I press Delete or after I wakeup the PC from sleep.
     
    Bwacky likes this.
  10. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    218
    It's annoying to the point it's faster to open a file in explorer and delete it there alongside its meta when I know it's not a crucial file.
     
  11. schouffy

    schouffy

    Joined:
    Mar 8, 2015
    Posts:
    10
    Same here, first deletion is slow then following ones are fast. 2022.3.8f1.
     
  12. DevPanela

    DevPanela

    Joined:
    Aug 11, 2019
    Posts:
    7
    Bump. It seems to get increasingly worse as projects grow. Very annoying
     
  13. bartje86tralala

    bartje86tralala

    Joined:
    Aug 1, 2012
    Posts:
    9
    Deleting many trees (+1000), just makes unity hang forever. The fix is, to create a new Scene, copy all objects except the ones you want, then delete old scene... still in: 2023.3.
    And also indeed, deleting an empty! folder, just freezes unity.