Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

15sec load time when editing script (w log)

Discussion in 'Editor & General Support' started by BigRookGames, Jan 10, 2021.

  1. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    299
    I am trying to hammer down some issues I've been experiencing with editor performance and notice that when I save a script with a minor change there is about 15 seconds of refresh time:

    ImportAndPostprocessOutOfDateAssets: 15859.553ms (7669.312ms without children)
    CompileScripts: 7882.185ms
    I am on version 2020.2 so I used the simple parser and nothing seems to be showing up with a significant time:
    upload_2021-1-10_13-3-52.png

    Is there anything else that I can look into for what is causing the long load times?

    a lot of the time is spend in the v2 compileScripts portion, and the other half seems to be in the reload assemblies portion, but I just don't know how to dig deeper.
    upload_2021-1-10_13-8-25.png
    upload_2021-1-10_13-10-54.png
    more logs below:

    Start importing Assets/Scripts/Hostile Mars/Objects/SurvivalEnergyConsumptionObject.cs using Guid(263705ffe7b3e374e8a8bf50ff616514) Importer(-1,00000000000000000000000000000000) -> (artifact id: '05d190576dd1387a53a2c33503410a73') in 0.012202 seconds
    AssetDatabase: script compilation time: 1.009847s
    - Starting script compilation
    - Starting compile Library/ScriptAssemblies/Assembly-CSharp.dll
    Deleting stamp file at Library/ScriptAssemblies/BuiltinAssemblies.stamp
    - Skipping compile Library/ScriptAssemblies/Assembly-CSharp-Editor.dll because all references are unchanged
    - Starting ILPostProcessorRunner
    - Starting ILPostProcessor 'Unity.DataFlowGraph.CodeGen.DataFlowGraphILPostProcessor' on Assembly-CSharp.dll
    - Finished ILPostProcessor 'Unity.DataFlowGraph.CodeGen.DataFlowGraphILPostProcessor' on Assembly-CSharp.dll in 3.920729 seconds
    - Starting ILPostProcessor 'Unity.Entities.CodeGen.EntitiesILPostProcessors' on Assembly-CSharp.dll
    - EILPP : Assembly-CSharp : : 1663ms (~101ms)
    - EILPP : Assembly-CSharp : GetAllComponentTypes: 230ms
    - EILPP : Assembly-CSharp : InjectOnCreateForCompiler: 4ms
    - EILPP : Assembly-CSharp : AuthoringComponentPostProcessor: 12ms
    - EILPP : Assembly-CSharp : BlobAssetSafetyVerifier: 121ms
    - EILPP : Assembly-CSharp : LambdaJobsPostProcessor: 856ms
    - EILPP : Assembly-CSharp : SingletonAccessPostProcessor: 2ms
    - EILPP : Assembly-CSharp : JobReflectionDataPostProcessor: 118ms
    - EILPP : Assembly-CSharp : WriteAssembly: 219ms
    - Finished ILPostProcessor 'Unity.Entities.CodeGen.EntitiesILPostProcessors' on Assembly-CSharp.dll in 1.665878 seconds
    - Starting ILPostProcessor 'Unity.Properties.CodeGen.PostProcessor' on Assembly-CSharp.dll
    - Finished ILPostProcessor 'Unity.Properties.CodeGen.PostProcessor' on Assembly-CSharp.dll in 0.004128 seconds
    - Finished ILPostProcessorRunner in 5.703165 seconds
    - Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll in 6.673462 seconds
    - Finished script compilation in 6.709619 seconds

    (roughly 125 minor warnings)

    Reloading assemblies after forced synchronous recompile.
    Begin MonoManager ReloadAssembly
    Native extension for WindowsStandalone target not found
    Refreshing native plugins compatible for Editor in 4.41 ms, found 6 plugins.
    Preloading 0 native plugins for Editor in 0.00 ms.
    TypeManager.Initialize took: 532ms
    Invoked RoslynAnalysisRunner static constructor.
    RoslynAnalysisRunner will not be running.
    RoslynAnalysisRunner has terminated.
    [MODES] ModeService[none].Initialize
    [MODES] ModeService[none].LoadModes
    [MODES] Loading mode Default (0) for mode-current-id-Hostile Mars Alpha Prototype
    Mono: successfully reloaded assembly
    - Completed reload, in 7.545 seconds
    Platform modules already initialized, skipping
    Reloading assemblies failed.
    Refreshing native plugins compatible for Editor in 4.47 ms, found 6 plugins.
    Preloading 0 native plugins for Editor in 0.00 ms.
    Refresh completed in 16.612720 seconds.
    RefreshInfo: RefreshV2(AllowForceSynchronousImport) scanfilter:
    RefreshProfiler: Total: 16611.312ms
    InvokeBeforeRefreshCallbacks: 1.018ms
    ApplyChangesToAssetFolders: 0.099ms
    Scan: 12.969ms
    OnSourceAssetsModified: 0.659ms
    InitializeImportedAssetsSnapshot: 32.998ms
    GetAllGuidsForCategorization: 4.853ms
    CategorizeAssets: 623.504ms
    ImportAndPostprocessOutOfDateAssets: 15859.553ms (7669.312ms without children)
    ImportManagerImport: 28.493ms (15.214ms without children)
    ImportInProcess: 13.245ms
    UpdateCategorizedAssets: 0.034ms
    CompileScripts: 7882.185ms
    PostProcessAllAssets: 176.272ms
    ReloadImportedAssets: 1.515ms
    EnsureUptoDateAssetsAreRegisteredWithGuidPM: 6.758ms
    InitializingProgressBar: 0.004ms
    PostProcessAllAssetNotificationsAddChangedAssets: 2.657ms
    OnDemandSchedulerStart: 3.081ms
    RestoreLoadedAssetsState: 32.181ms
    UpdateImportedAssetsSnapshot: 57.095ms
    ReloadSourceAssets: 22.813ms
    UnloadImportedAssets: 2.611ms
    Hotreload: 24.604ms
    FixTempGuids: 0.006ms
    GatherAllCurrentPrimaryArtifactRevisions: 0.953ms
    UnloadStreamsBegin: 0.186ms
    LoadedImportedAssetsSnapshotReleaseGCHandles: 2.324ms
    GetLoadedSourceAssetsSnapshot: 53.577ms
    PersistCurrentRevisions: 1.211ms
    UnloadStreamsEnd: 0.238ms
    GenerateScriptTypeHashes: 13.234ms
    Untracked: -32.865ms
    [MODES] ModeService[default].RefreshMenus
    [MODES] ModeService[default].UpdateModeMenus
    Refresh completed in 0.014542 seconds.
    RefreshInfo: RefreshV2(AllowForceSynchronousImport) scanfilter:
    RefreshProfiler: Total: 13.505ms
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    15,704
    Once your project reaches a certain size, 15 seconds sounds about average for a domain reload.

    There are ways to optimize domain reload speeds using assemblies or precompiling stuff into DLLs, but I find they are all awkward and tend to make a disjointed mess of your project.

    Google around for long domain reload times in Unity. There's some reading to be had.
     
    BigRookGames likes this.
  3. BigRookGames

    BigRookGames

    Joined:
    Nov 24, 2014
    Posts:
    299
    Thanks, I will dig into that topic now. As far as using assemblies and precompiling into DLLs, is there a lot of room for improvement there when referring to larger projects? I have put a lot of effort into assemblies when it was around 30 seconds and it reduced it some, but considering a decent-sized project, is most of that time (remaining 15 sec) able to be reduced through further grooming of the scripts? or is it more on asset management and prefabs?

    I am also aware of the domain reload and scene reload stuff which I have used in the past, but want to get the baseline down as far as possible too, so just seeking out any potential improvement areas I may be missing.

    Thanks again, I'm sure I will probably find additional information while searching more.
     
  4. pokruchin

    pokruchin

    Joined:
    Apr 24, 2019
    Posts:
    36
    Hello, BigRookGames! Were you able to solve this issue? I'm having absolutaly the same behaviour on a quiet large project.
     
unityunity