ULandscapeHeightfieldCollisionComponent::CreateCollisionObject is slow

Most of the time is spend deserializing Chaos::FHeightfield::Data::Heights and Chaos::FHeightfield::Data::MaterialIndices which are respectively a TArray<uint16> and TArray<uint8>.

[Image Removed]

I improve the Unreal Insight trace to better observe the issue. We can see that Unreal spend ~1.5ms to deserialize ~192kb

Looking into the code, I feel like it could be faster.

Steps to Reproduce
To reproduce the issue, open the provided project (which is the VehicleExample template with an added Landscape to emphasize the issue).

Package the project.

Start the packaged build with argument -statnamedevent and collect a trace.

You should be able to observe a trace that match the screenshot I provided.

Hi,

I believe that the load times can be improved by this pull request: https://github.com/EpicGames/UnrealEngine/pull/12878

Our devs haven’t had the time to look at it yet but it seems something that would help in your case.

I’ll pass the question to our Simulation team to make sure they are aware of the problem.

Regards,

Martin

Hi Martin!

Thanks for the pull request. It makes the serialization much faster, and after a week of testing I did not experience any issue.

I hope someone at Epic can review the pull request soon so that everyone can get faster serialization.

Thanks again.