Skip to content

Instantly share code, notes, and snippets.

@aras-p
Created December 15, 2022 10:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aras-p/9e2304bc9e3e9e68bff7978c4f1033d9 to your computer and use it in GitHub Desktop.
Save aras-p/9e2304bc9e3e9e68bff7978c4f1033d9 to your computer and use it in GitHub Desktop.
Opening random Unity project in one minute, profiling dump
Unity 2022.2.0f1 official release.
I get changes from version control, about a dozen files changed (1 commit), then I open Unity.
It takes about one minute to open the project. The project Assets is 23GB (143k files), it also references
some local packages which is 8GB (63k files). Large part of project assets folder is custom data not used
by Unity's import pipeline ("baked" files for game, under StreamingAssets folder, 13GB, 47k files).
63s: InitializeProject
62s: InitialRefreshV2
54s: RefreshInternalV2
30s: ImportOutOfDateAssets
16s: ScriptingInitializer::FinalizeReload
16s: SetupLoadedEditorAssemblies
10s: Packages.Rider.RiderScriptEditor..cctor
10s: Unity.CodeEditor.CodeEditor.Register
9s: Packages.Rider.Editor.ProjectGeneration.ProjectGeneration.GenerateAndWriteSolutionAndProjects
8.5s: GenerateAllAssetProjectParts
50% of that in GetFileAttributesW
the rest is a death by a thousand string operations?
1.0s: SyncProject
3s: Burst.Editor.BurstLoader..cctor
RequestSetProtocolVersion -> SendCommandToCompiler -> BurstCompilerService.GetDisassembly -> CacheManager.LoadCache -> AssemblyResolver.ReadModule etc.
0.6s: XRBuildSystem::DiscoverAllPluginsImpl, calls a bunch of FindAssetImporterAtAssetPath
14s: AssetImportManager::Import
10s: ScriptedImporter::GenerateAssetData
9s: ShaderGraphImporter.OnImportAsset
9s: BuildAllShaders
6s: CreateShaderAsset
2s: ShaderGraph.Generator..cctor
1.5s: RegisterGraphicsPipelineDependecies
0.7s: HDRenderPipelineAsset.OnEnable
0.7s: SetupDLSSFeature
0.6s: NVSDK_NGX_D3D11_Init_ProjectID
22s: MonoScriptManager::InitializeRegisteredScripts
A ton of calls through chain of PPtr<Object> -> PersistentManager::ReadObject -> SerializedFile::InitializeRead -> OpenFileCache::OpenCached -> CreateFileW -> wait on some event/whatever
8s: ProcessPostProcessAllAssetNotificationsAndHotReload
8s: CallPostProcessAllAssetsCallbacks
5s: RiderScriptEditor.SyncIfNeeded
5s: GenerateAllAssetProjectParts
50% of that in GetFileAttributesW
the rest is a death by a thousand string operations?
0.6s: TextMeshPro OnPostprocessAllAssets
LoadAssetAtPath on some Texture2D serialized assets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment