Search Unity

Application reload is extremely slow

Discussion in 'Burst' started by Knedlo, May 3, 2021.

  1. Knedlo

    Knedlo

    Joined:
    Oct 15, 2012
    Posts:
    54
    Hi,

    I have a larger project that I am currently refactoring towards DOTS. It is going to take many iterations and because I now consider the iteration speed the biggest hinderance to my progress as well as my mental health I would like to improve them somehow.

    I used AsmdefDebug from https://gist.github.com/karljj1/9c6cce803096b5cd4511cf0819ff517b to get some data:
    Compilation Report: 29,52 seconds
    1,45s CommonUnity.dll
    compilation total: 1,45s
    Assembly Reload Time: 28,0762579s

    My project is split into about 40 assemblies with serviceable dependencies and compile times are fine. However assembly reload is just crazy. The worst is, that it is focus breaking. I don't have much trouble waiting for 10s, but with three times that, I am often tempted to fill the time by doing something else and before I know it, ten minutes of productive time are gone and my mental context is in shambles.

    So I continued with Editor Iteration Profiler and found this:
    upload_2021-5-3_8-49-8.png
    One of the hefty calls is InitializeAllComponentTypes under TypeDependencyCache. It dwarfs everything else, but BurstLoader is not too fast either.

    I assume that this is not normal, so my question is, why would something like this be happening? What can I do, to fix this?

    Any help is welcomed!
     
  2. tim_jones

    tim_jones

    Unity Technologies

    Joined:
    May 2, 2019
    Posts:
    287
    Hi @Knedlo - which version of the Burst package, and which version of Unity, are you using?

    We did make a number of improvements to BurstLoader's domain reload time, making it roughly an order of magnitude faster, and the time you're seeing there looks more like the old slow time than the new fast time. Those improvements require Unity 2019.3+ and Burst 1.4+.

    If you have both of those, then it might be something else... can you expand the BurstLoader tree node from that screenshot in case there are some child nodes that reveal something useful?
     
  3. xoofx

    xoofx

    Unity Technologies

    Joined:
    Nov 5, 2016
    Posts:
    417
    Don't see this code used anymore in the official Unity versions. Which version are you using? Could try on a newer/updated version?

    The Scripting Team and other teams at Unity are gearing up to improve iteration time.
     
  4. Knedlo

    Knedlo

    Joined:
    Oct 15, 2012
    Posts:
    54
    Hi @tim_jones and @xoofx

    Thanks for the info.

    I'm running Burst 1.4.1 with Unity 2020.3.5f1. I am not using newer version of Unity as it is supposed to be incompatible with Entities.

    Here's a screen of the expanded BurstLoader:
    upload_2021-5-11_19-19-48.png
     
  5. Knedlo

    Knedlo

    Joined:
    Oct 15, 2012
    Posts:
    54
    Also I should add some more info.

    I am currently using couple of managed components. I queried the code base and total numbers are:
    Managed components: 7 (lowering the number of managed components didn't change anything noticable)
    Unmanaged components: 42
    Systems: 19
    Executable lines of code: about 10k
    Defined types: about 1k
    (I am evaluating switching to ECS, that's why the number of systems and components is so low compared to the whole)

    My system during the measuring was running on i7-2600k, 32GB and SSD. Since than I upgraded to Ryzen9 3900X. Measurements on upgraded machine looks like this:
    upload_2021-5-12_9-0-39.png
    It is better, sure, but the feeling that this is not right remains.

    upload_2021-5-12_9-3-38.png
     
    rhezafatria likes this.
  6. Knedlo

    Knedlo

    Joined:
    Oct 15, 2012
    Posts:
    54
    I have tried to reinstall all packages with latest versions. I also cleaned up unused packages. Currently the editor profiler sees this:
    upload_2021-5-14_9-37-49.png

    @tim_jones does it tell you anything?
     
  7. Knedlo

    Knedlo

    Joined:
    Oct 15, 2012
    Posts:
    54
    @xoofx I am adding content of my manifest.json. Any idea why an obsolete code would be called? The Unity version is still the latest LTS (Unity 2020.3.5f1)

    Code (JavaScript):
    1. {
    2.   "testables": [
    3.     "com.unity.entities",
    4.     "com.unity.collections",
    5.     "com.unity.jobs",
    6.     "com.unity.test-framework.performance"
    7.   ],
    8.   "dependencies": {
    9.     "com.unity.2d.sprite": "1.0.0",
    10.     "com.unity.addressables": "1.18.4",
    11.     "com.unity.analytics": "3.5.3",
    12.     "com.unity.burst": "1.4.8",
    13.     "com.unity.collections": "0.15.0-preview.21",
    14.     "com.unity.editoriterationprofiler": "0.1.1-preview",
    15.     "com.unity.entities": "0.17.0-preview.41",
    16.     "com.unity.ext.nunit": "1.0.6",
    17.     "com.unity.ide.visualstudio": "2.0.8",
    18.     "com.unity.inputsystem": "1.0.2",
    19.     "com.unity.render-pipelines.universal": "10.4.0",
    20.     "com.unity.rendering.hybrid": "0.11.0-preview.42",
    21.     "com.unity.shadergraph": "10.4.0",
    22.     "com.unity.test-framework": "1.1.24",
    23.     "com.unity.testtools.codecoverage": "1.0.0",
    24.     "com.unity.textmeshpro": "3.0.6",
    25.     "com.unity.ugui": "1.0.0",
    26.     "com.unity.ui": "1.0.0-preview.14",
    27.     "com.unity.ui.builder": "1.0.0-preview.14",
    28.     "com.unity.modules.ai": "1.0.0",
    29.     "com.unity.modules.androidjni": "1.0.0",
    30.     "com.unity.modules.animation": "1.0.0",
    31.     "com.unity.modules.assetbundle": "1.0.0",
    32.     "com.unity.modules.audio": "1.0.0",
    33.     "com.unity.modules.cloth": "1.0.0",
    34.     "com.unity.modules.director": "1.0.0",
    35.     "com.unity.modules.imageconversion": "1.0.0",
    36.     "com.unity.modules.imgui": "1.0.0",
    37.     "com.unity.modules.jsonserialize": "1.0.0",
    38.     "com.unity.modules.particlesystem": "1.0.0",
    39.     "com.unity.modules.physics": "1.0.0",
    40.     "com.unity.modules.physics2d": "1.0.0",
    41.     "com.unity.modules.screencapture": "1.0.0",
    42.     "com.unity.modules.terrain": "1.0.0",
    43.     "com.unity.modules.terrainphysics": "1.0.0",
    44.     "com.unity.modules.tilemap": "1.0.0",
    45.     "com.unity.modules.umbra": "1.0.0",
    46.     "com.unity.modules.unityanalytics": "1.0.0",
    47.     "com.unity.modules.unitywebrequest": "1.0.0",
    48.     "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    49.     "com.unity.modules.unitywebrequestaudio": "1.0.0",
    50.     "com.unity.modules.unitywebrequesttexture": "1.0.0",
    51.     "com.unity.modules.unitywebrequestwww": "1.0.0",
    52.     "com.unity.modules.vehicles": "1.0.0",
    53.     "com.unity.modules.video": "1.0.0",
    54.     "com.unity.modules.vr": "1.0.0",
    55.     "com.unity.modules.wind": "1.0.0",
    56.     "com.unity.modules.xr": "1.0.0"
    57.   },
    58.   "scopedRegistries": [
    59.     {
    60.       "name": "OpenUPM",
    61.       "url": "https://package.openupm.com",
    62.       "scopes": [
    63.         "com.unity.editoriterationprofiler"
    64.       ]
    65.     }
    66.   ]
    67. }
     
  8. leonhogan1

    leonhogan1

    Joined:
    Apr 21, 2020
    Posts:
    13
    im getting this problem as well. Any updates?
     
    Matt-Ostgard, kishak and HuldaGnodima like this.