A Tiny Performance Issue In UE4 Camera View

Issue Introduction

I’ve been playing with streamlines for quite a long time. And actually it helps us a lot to find our performance issue.

In our project, camera view point information is required in a lot of places. By default we use function like APlayerCameraManager::GetCameraViewPoint to get exactly what we need.

However we’ve found that a strange function cost:

image-20220118153154176

So it seems that a copy construction of FMinimalViewInfo is performed here:

image-20220118153353029

And yes, there is a FPostProcessSettings, a complex struct, inside a FMinimalViewInfo. And this can cost a considerable CPU performance.

Issue Solution

Well we simply avoid copy construction of FMinimalViewInfo and directly return those result required. This can save some performance.

An Irrelevant Note

Well… I just need a place to write this down since I always forget this feature.

If you want a detailed performance information about slate performance. You can visit slateglobals.h to find more information.

I am so cute, please give me money...