Description

 

AActor ContainsDataLayer Is Slow: Navigation builds are heavily slowed down by TObjectPtr to TSoftObjectPtr conversions when checking if DataLayerAssets contain

 

Users discovered a huge time loss in navigation build during conversions from TObjectPtr to TSoftObjectPtr. This specific optimization ended up saving our team 1.5hrs on our navigation builds and seems like an easy optimization that would be great for your team to integrate into the engine.

 

Core Issue:

  • When using a world partition with dynamic mode, FNavigationDirtyElement has to asking if the owner actor IsInBaseNavmesh
  • The process of asking IsInBaseNavmesh has to iterate over all BaseNavmeshLayers, and ask if the Actor ContainsDataLayer
  • ContainsDataLayer has to convert from TObjectPtr to TSoftObjectPtr when checking if it is within DataLayerAssets

 

Optimization:

  • Caching the TSoftObjectPtr for a given BaseNavmeshLayer, saves on having to do Millions of conversions here
    • (Number of BaseNavMeshLayers) * (Actor Count + Parented Actor)

 

Overall the process of Converting from TObjectPtr to TSoftObjectPtr is slow due to FString operations & string analysis during the conversion process, and skipping the conversions all together saved our nav build process 1.5 hrs for one of our biggest maps. Also HasDataLayers is pretty slow as well, due to needing to compute the array of DataLayerInstances just to toss it out when doing the Num check. Any improvements to these hot code paths would be greatly appreciated.

Steps to Reproduce
  • Steps to Reproduce
    <projectName>  -run=WorldPartitionBuilderCommandlet <WorldPartitionMapPath> -Builder=WorldPartitionNavigationDataBuilder -log=WPNavigationBuilderLog.txt -SCCProvider=Perforce -unattended
    LikeSelect as Best
     

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-230596 in the post.

0
Login to Vote

Unresolved
Target Fix5.6
CreatedNov 15, 2024
UpdatedNov 20, 2024
View Jira Issue