Optimization

Optimization is a heavy subject in Unreal. It is the root cause of most end-user "issues" and is often the area where players feel developers should have spent more time.

My goal here is to shed light on how to better optimize your projects from a systems-level perspective. As this section grows, this page will evolve into a directory for more specific sub-folders, but the URL will remain the same.


When Should You Look at Optimization?

There is a common mantra in development: "Don't optimize early." This usually means you shouldn't waste time micro-optimizing every small change before the system is even finished. While I agree with the sentiment, the "when" is always up for debate.

My rule: Optimize whenever you feel the need to. After adding a new system, check your profiling tools to see how that addition affects the game as a whole. While an experienced developer can often "feel" when a game becomes laggy or unresponsive, you shouldn't rely on gut feeling alone. Profilers exist to turn that "feeling" into actionable data.

Important

A Fact on Blueprints: If you are having performance issues and your logic is primarily in Blueprints, the issue is likely the overhead of the Blueprint Virtual Machine (VM). This isn’t a "hot take"—it’s a technical reality. For heavy lifting, C++ is non-negotiable.


What Are Some Basic Tools?

The first thing I turn to—outside of a simple FPS counter—is the stat command system.

1. stat Unit

Before diving into specific code, you need to know where the bottleneck is. stat Unit breaks down the frame time into:

2. stat Game

If stat Unit tells you the "Game" thread is the bottleneck, stat Game is your next stop. It provides a real-time breakdown of:

3. Beyond Stats: Unreal Insights

While stat commands are great for a quick glance, they only show you a "snapshot." Unreal Insights is the real workhorse. It records a "trace" of every single function call across every thread.


The "Game Thread" Killers

For a systems developer, the Game Thread is where the real war is won.

The "Tick" Problem

The easiest way to destroy performance is by having hundreds of actors Ticking.

Blueprint "Heavy Lifting" (The VM Tax)

The Blueprint VM has a high overhead for math-heavy or loop-heavy logic.


Memory Alignment & TArrays

Since we're talking C-style C++, pay attention to your data structures.


Summary: The Optimization Workflow

If you’re staring at a laggy project, don’t guess. Follow this order:

  1. Run stat Unit: Identify if you are Game, Draw, or GPU bound.
  2. Check stat Game: Look for the "Tick" or "Blueprint" time.
  3. Profile with Unreal Insights: Find the exact function or node responsible for spikes.
  4. Refactor to C++: If a Blueprint system eats more than 1–2ms of your frame, move it to C++.

Optimization isn't a "final step"; it's a habit of choosing the lowest-overhead path while you're building.