Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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,389
    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:
      339
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,167
    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,389
    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:
    105
    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,167
    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,226
    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:
    118
    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 ;{