A licensee reports that their large map has a 10s cost in the AssetRegistry when resaved. They took a profile and found the cost is mostly in LoadCalculatedDependencies for the map, and most of that cost is in modifying the FDependsNodes.
Optimize this case.
Suggested optimization is
FDependsNode containers are optimized for memory reduction with the expectation that they will not be updated much. We have other modes for them that we use during startup scanning to avoid the costs.
The function to call is SetPerformanceMode(Impl::EPerformanceMode::BulkLoading), which you can find examples of in AssetRegistry.cpp.
Change it to instead be AddRefPerformanceMode and ReleasePerformanceMode, so that we can turn it on and off from a code path without worrying about whether it is already on.
Then add this code to UAssetRegistryImpl::OnDirectoryChanged:
void UAssetRegistryImpl::OnDirectoryChanged(const TArray<FFileChangeData>& FileChanges) { TRACE_CPUPROFILER_EVENT_SCOPE(UAssetRegistryImpl::OnDirectoryChanged); double StartTime = FPlatformTime::Seconds(); // New code AddRefPerformanceMode(); ON_SCOPE_EXIT { ReleasePerformanceMode(); } // End new code ...
If even in performance mode LoadCalculatedDependencies is too slow, then the best next step is to extend the type of cputime optimizations we make during performance mode, we will need to look at a capture with performance mode on before we can tell what those optimizations should be.
In a large WorldPartition map with many actors, modify it and save it.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-218488 in the post.
1 |
Component | UE - Foundation - Core |
---|---|
Target Fix | 5.5 |
Created | Jun 21, 2024 |
---|---|
Updated | Jun 25, 2024 |