Performance Profiling Primer

Apr 29, 2021.Knowledge

Let’s say you’ve found that your project isn’t performing well. It’s not running at a desirable framerate, but you’re not sure where to start. If that’s the case, then this primer is for you!

The most important thing we need to figure out is whether your issue is CPU performance (blueprints, navigation, AI, etc.) or on the GPU (materials, triangles, textures, postprocessing etc.).

With your project running, we’ll want to run the console command stat unit . This will show you the total frame time, the game thread time, the draw thread time, the GPU thread time, and the RHI thread time. What we’re looking for here is the highest number. If it’s the GPU, then we’re running into render performance issues (see below). If the number is the Game thread, then we’re running into CPU performance issues.


CPU Performance

For diagnosing CPU performance issues, you’ll want to take advantage of Unreal Insights, or stat dumphitches to figure out what CPU functions are causing a hitch (if that’s the case, those hitches will be written to your log file). A lot of the time, CPU issues show up in Event Tick functions so that may be a good place to start looking in your blueprints.

Here’s a few more resources for Unreal Insights:

GPU Performance

There’s a lot of different factors that can affect GPU performance, including triangle count and size, material complexity, screen resolution, and so on and so on. The first step is to check stat gpu and see which draw step is really high. You can also do that in a single frame in the editor with the GPU Profiler. From here it depends on what’s causing issues, sometimes it’s ShadowDepths (in which case dynamic shadows are likely being drawn too far out, you can read more about how to optimize dynamic shadows in the knowledgebase). If it’s BasePass, that likely means either triangle count (which you can test with the Quad Overdraw view mode, material complexity (which you can check with the Shader Complexity view mode), or draw calls (you can check this with stat rhi and look at the DrawPrimitve Calls value).

The remedies for these issues are numerous and various, so it really depends on what the specific issue is. I’ve gathered a few additional resources about GPU profiling that may be useful to you as well:

We’ve got a lot more information available on Performance and Profiling in our documentation, so be sure to take a look!