Search Unity

Is Unity (noticeably) slower with a lot of assets in the project folder? Would an SSD help?

Discussion in 'Editor & General Support' started by PhoenixAdvanced, Apr 10, 2018.

  1. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Hi,

    I have been working with Unity for some time now, and I am in the process of creating a very complex project. I have noticed that the Unity editor is often quite slow to respond, especially when switching to the editor from another tab.

    This could be because my project needs to be optimised, but I have a question. Do assets simply stored in the project folder (textures, prefabs, etc, etc) have an effect on the editor's performance and responsiveness, even when those assets are not loaded into memory, or referenced in the scene?

    Secondly, if I was to get something like an NVMe SSD (or a regular SSD) and copy JUST my project to that SSD (IE, not install my OS on it, just my project) would this improve the performance of the Unity editor during development?

    I am mainly talking about working with the editor itself here, not playing the game using the editor, since the latter case would, I am sure, be affected far more by the assets that are being actually loaded and used, not just stored, on the disk.

    Thanks for any advice!
     
  2. poisonnuke

    poisonnuke

    Joined:
    Nov 22, 2016
    Posts:
    82
    I can only say, that EVERYTHING inside the assed-folder is loaded to memory, even if not used. Thats is the reason, why simply adding an faulty script will block the editor/game preview.

    AFAIK is Unity handling all the assets pretty efficient, because in the end it is only using the meta files until a material is assigned of course. But it will check for changed files every time the windows-focus is changed.

    So yes, a SSD will help alot, because for testing purposes Ive added like half the asset store to a project and still it was very responsive to me.
     
    DerrickMoore likes this.
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,442
    You can also Profile the editor to see if anything interesting there.
     
  4. tsibiski

    tsibiski

    Joined:
    Jul 11, 2016
    Posts:
    604
    Every time you switch focus, Unity checks for anything that would necessitate recompilation (such as a diff in your cs files, or any asset that does not have an associated .meta file).

    This would be the most likely cause of your delays when switching tabs. Normally, this process doesn't seem to impact me at all, but I've never worked in a project that I would consider super complex.

    A SSD drive is excellent for accessing files quickly, so I suspect it would make a difference. Particularly, a spinning disk drive chugs and chugs as it nears its death. The first symptoms tend to be slow read times, especially when reads are done a lot in a short period (like this), and also you will probably notice a tangible slowdown in how long it takes to do your initial boot up. Also, another symptom is right clicking on your desktop, and it taking a while for the right click mouse context menu to appear. Some of these may not be universal, so I am sure someone will correct me if I am wrong, but I have had two hard drives die. One died very quickly, and the other died over the span of about a month. Both showed these behaviors leading up to the hard drive becoming useless. In particular for the month long drive death, the bootup went from 15 seconds to 5 minutes long. Eventually, it took 60 seconds for the mouse context menu to appear as well.

    It is possible that this is a symptom of your hard drive beginning a downward spiral. But it could be caused by something completely unrelated. I'd say, if you can afford it, definitely get an SSD. They are great for so many things, and the price for the tech is definitely plummeting as availability begins to exceed demand, and it becomes more mainstream. And even if you put all the Unity stuff on the SSD, it isn't a loss, because you have an awesome new SSD (and you've narrowed down the cause of the issue too).
     
    Last edited: Apr 11, 2018
  5. mountblanc

    mountblanc

    Joined:
    Sep 24, 2015
    Posts:
    93
    The main lag of a normal hard disk is the head movement. Like hard drives however there is plenty of difference of performance in SSD drives. The read and write times can vary enormously but even a low end (speed) SSD will speedup things a lot compared to a HD drive. However your system should be able to reach the speeds the SSD provides. You can add an SSD to an old system but then the speed will be limited to the max speed of the motherboard.

    Normaly a Hard drive will not slow down over time. except when it has bad sectors. But then again you can let the bad sectors be marked with a HD tool so they will not be used anymore and once again your HD will have full speed again. However mostly when a HD starts having bad sectors it is often the beginning of the end.

    However there is a big difference with an HD compared to an SSD. If an HD gets bad sectors mostly some data is corrupted but mostly you can at least get to most files before it is to late.

    When SSD's fail mostly you loos all your data at once. ( And yes SSD's do fail! )

    Google has some documents about SSD's compared to HD drives and all but I am getting off topic.

    To answer your question : YES your project will be faster even if you only move your project to SSD.

    I myself have a lower end SSD (500MB /s read times) and I even moved my project to RAM drive to speed it up even more. However by Ram drive is only 8Gb and only 2Gb is remaining so soon I must move back to SSD again.

    If you want also faster build times select the output folder also on de SSD that saves also a lot of time.
    If possible Install Unity also on the SSD This make it all go faster as well.
     
  6. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,534
    SSD's are much faster than HDD's. You should upgrade immediately as they're standard for primary drives today.
     
  7. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    Thank you very much for your replies! It seems that the consensus is that an SSD will make a big difference, I think I'll certainly try one out and see.

    My motherboard does support M.2 NVMe SSD's at full speed, and there are some very good NVMe disks out there. I am concerned about the reliability though, the warranty's usually only last 5 years, which isn't a lot compared to a regular hard disk, and as mountblanc said, with an SSD, if it fails, there is no chance of data recovery. With a HDD, I've had excellent results getting data off of damaged disks in emergencies.

    tsibiski's comment made it very clear what is happening, and what causes the performance hit. An SSD is probably the only thing that would make a difference here, other than removing elements from my asset folder.

    My main disk is only about 2 years old, and it's high end, so it's not "near death". Or at least, I hope it's not :p The SMART tools report that it is doing fine, and I keep daily full backups just in case.

    WIth and SSD, I will probably need to make my backup strategy more aggressive.

    poisonnuke, when you said "everything is loaded to memory", did you mean that everything was scanned for changes, or everything was literally loaded into memory? I mean if I have, for example, 100gbs of data in the asset folder, that couldn't all be loaded into memory, I don't have that much memory?
     
  8. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Regular hard disk warranty periods are typically 1 - 5 years, so an SSD with a 5 year warranty is actually pretty good. The warranty period has nothing to do with the safety of your data though. All it means is that you will get a replacement drive within that time period if it does fail (a used drive that previously failed that they repaired, not a new drive). Your data is still gone regardless. The cost of the warranty to the company is simply something priced into the original purchase price of the drive and has really nothing to do with the quality of the drive. They would offer a 50 year warranty and charge a bit more for the drive to cover it if they thought it would improve sales (without actually improving the quality of the drive), but the tech changes so quickly there is little reason to offer a warranty beyond 5 years.

    As far as what is loaded into memory, my understanding is all scripts in the entire project are loaded into memory for compilation. All assets referenced in your open scene are loaded into memory. Every time you tab back into Unity the entire assets folder is checked for changes, every folder is checked for new files, modified files, or removed files, etc, which if you did have 100 gigs in your assets folder that could be a considerable task.

    As already mentioned, SSD's have no moving parts and by their nature can access any location in the drive at the same speed as any other location. Standard hard disks only hit max throughput when the data they are reading is all in a row, and take a comparative eternity to access data stored in a different area of the drive. Since you can't predict what order Unity will want to access different files in your assets folder, it would be difficult to optimize that for a standard hard disk beyond defragmenting individual files. Standard hard disks do ok when dealing with a small number of large defragmented files, but do poorly with a large number of files being accessed in an arbitrary order due to having to constantly seek the drive head for every file. Unity projects tend to have lots of small files.
     
    Last edited: Apr 11, 2018
  9. poisonnuke

    poisonnuke

    Joined:
    Nov 22, 2016
    Posts:
    82
    both statements are not true. HDDs can fail at once (bad electronics, head crash, faulty magnetic layer ... ) and SSDs can fail slowly. They access files in sectors too, but only the internal arragement is different. If a cell fails, the whole sector fails and so some files might get lost. But in the end, every SSD has more or less spare sectors.

    compared to each other, SSDs tend to be more reliable, because there is no mechanical failure like for HDDs and datacenter statistics tell the same story.
     
  10. PhoenixAdvanced

    PhoenixAdvanced

    Joined:
    Sep 30, 2016
    Posts:
    316
    I just looked up the warranty period for my current disk (WD Caviar Black) and you're absolutely right, it is just 5 years, I could have sworn it was 10. I guess an SSD wouldn't be that different then?

    I'll just need to modify my backup strategy to backup two disks at once, I guess, which shouldn't be an issue.

    I guess I'm just a little wary of newer technologies, I heard quite a lot of negative press about SSD reliability when they first came out.