-
Notifications
You must be signed in to change notification settings - Fork 140
Improve performance when opening large projects #2271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
FileSystemPathTrie is not enumerable, and GetSubtreeData will create a new list on each call, which is very expensive with tens of thousands of files and how often SourceFiles is accessed
Fixes RIDER-53358
A further note on The The UnityYaml language does not have a PSI
Asset files under Meta files now have |
However, this is very slow for our project, which is 4T in size. So can we provide an option to directly block meta file processing, because we only need to use Rider's Debug function? |
@wqaetly would you please create a separate report in Rider with Help-> Report a Bug? |
No, it's not a bug of rider, because after I disabled Unity Plugin, it only took one minute to refresh. |
Since this plugin is bundled in Rider, we started to use youtrack for all major planning and Q&A. |
sorry i cannot , because it's company project |
i am using Rider 2025.1, the problem remain existing |
Please start a new issue (in Rider) or a support ticket. Otherwise, unfortunately in this thread to an issue, which was closed long ago, you would not get any help. |
This PR fixes a number of performance issues when opening projects that have a very large number of assets and meta files:
IPsiSourceFile
instances for asset and meta files. Fixes RIDER-53358We efficiently get this information when calling
GetDirectoryEntries
to discover asset and meta files inAssets
,ProjectSettings
and package folders, but creating the PSI source file will go back to the disk for every single file to get timestamp, length and file attributes. This has a massive impact on very large projects (tens of thousands of files), and can cause further problems on certain OS/drive/file system combos (e.g. exFAT on USB on Windows can take 12 minutes for 24,000 files just to get the information we've already got in memory)UnityExternalFilesPsiModule.SourceFiles
for very large projects.The module's trie isn't enumerable, and would allocate and populate a new collection on each access, and it is frequently accessed. The module now maintains a separate set of files as well as the trie.
UnityExternalPsiSourceFile
.The logic to look up the PSI language would allocate, first to get file extension to look up the
ProjectFileType
, then allocate again inUnityYamlProjectFileLanguageService.GetPsiLanguageType
when fetching thePsiLanguageType
. This has been simplified to pass theProjectFileType
in to the constructor, so no more allocations and lookups are required.This required introducing
MetaProjectFileType
, which derives fromYamlProjectFileType
and registers the.meta
file (which was previously handled byUnityYamlProjectFileType
, even though meta files didn't use theUnityYaml
PSI language). The appropriate project file type is calculated in the external module processor and passed in - the simple YAML project file type is used when creating files for theProjectSettings
folder.NodeTypeSet
. Saves several hundred megabytes on a very large project!