s.World.SkipPerfTrackerForUninitializedWorlds

s.World.SkipPerfTrackerForUninitializedWorlds

#Overview

name: s.World.SkipPerfTrackerForUninitializedWorlds

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of s.World.SkipPerfTrackerForUninitializedWorlds is to control the allocation of InGamePerformanceTrackers for uninitialized Worlds in Unreal Engine 5. This setting variable is primarily related to the performance tracking system within the engine’s World management.

The Unreal Engine subsystem that relies on this setting variable is the World system, which is a core part of the Engine module. It’s specifically used in the World initialization and creation process.

The value of this variable is set through a console variable (CVar) using FAutoConsoleVariableRef. It’s defined in the Engine/Source/Runtime/Engine/Private/World.cpp file and defaults to true.

This variable interacts directly with its associated boolean variable bDisableInGamePerfTrackersForUninitializedWorlds. They share the same value, and the boolean is used in the actual code logic.

Developers must be aware that when this variable is set to true (which is the default), it prevents the allocation of InGamePerformanceTrackers for Worlds that aren’t initialized. This can help reduce memory usage and improve performance in certain scenarios, particularly when dealing with multiple or temporary Worlds that don’t require performance tracking.

Best practices when using this variable include:

  1. Leaving it at its default value (true) unless there’s a specific need for performance tracking in uninitialized Worlds.
  2. If performance tracking is needed for all Worlds, including uninitialized ones, set this variable to false.
  3. Consider the impact on memory usage and performance when changing this setting, especially in projects with many Worlds or in memory-constrained environments.

Regarding the associated variable bDisableInGamePerfTrackersForUninitializedWorlds:

The purpose of this boolean variable is to directly control the logic for allocating InGamePerformanceTrackers in the World creation and initialization process.

It’s used in the UWorld constructor and the InitializeNewWorld function to determine whether to allocate PerfTrackers.

The value of this variable is set by the console variable s.World.SkipPerfTrackerForUninitializedWorlds.

Developers should be aware that this variable directly affects the creation of FWorldInGamePerformanceTrackers objects. When true, it prevents these objects from being created for uninitialized Worlds, potentially saving memory and improving performance.

Best practices for this variable are essentially the same as for s.World.SkipPerfTrackerForUninitializedWorlds, as they are directly linked. Developers should consider the trade-off between performance tracking capabilities and resource usage when deciding whether to enable or disable this feature.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:148

Scope: file

Source code excerpt:


static bool bDisableInGamePerfTrackersForUninitializedWorlds = true;
FAutoConsoleVariableRef CVarDisableInGamePerfTrackersForUninitializedWorlds(TEXT("s.World.SkipPerfTrackerForUninitializedWorlds"), bDisableInGamePerfTrackersForUninitializedWorlds, TEXT("When set, disables allocation of InGamePerformanceTrackers for Worlds that aren't initialized."));


static TAutoConsoleVariable<int32> CVarPurgeEditorSceneDuringPIE(
	TEXT("r.PurgeEditorSceneDuringPIE"),
	0,
	TEXT("0 to keep editor scene fully initialized during PIE (default)\n")

#Associated Variable and Callsites

This variable is associated with another variable named bDisableInGamePerfTrackersForUninitializedWorlds. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:147

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarDisableRemapScriptActors(TEXT("net.DisableRemapScriptActors"), bDisableRemapScriptActors, TEXT("When set, disables name remapping of compiled script actors (for networking)"));

static bool bDisableInGamePerfTrackersForUninitializedWorlds = true;
FAutoConsoleVariableRef CVarDisableInGamePerfTrackersForUninitializedWorlds(TEXT("s.World.SkipPerfTrackerForUninitializedWorlds"), bDisableInGamePerfTrackersForUninitializedWorlds, TEXT("When set, disables allocation of InGamePerformanceTrackers for Worlds that aren't initialized."));


static TAutoConsoleVariable<int32> CVarPurgeEditorSceneDuringPIE(
	TEXT("r.PurgeEditorSceneDuringPIE"),
	0,
	TEXT("0 to keep editor scene fully initialized during PIE (default)\n")

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:627

Scope (from outer to inner):

file
function     UWorld::UWorld

Source code excerpt:

	FWorldDelegates::OnPostWorldCreation.Broadcast(this);

	if (!bDisableInGamePerfTrackersForUninitializedWorlds)
	{
		PerfTrackers = new FWorldInGamePerformanceTrackers();
	}
	else
	{
		PerfTrackers = nullptr;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/World.cpp:2368

Scope (from outer to inner):

file
function     void UWorld::InitializeNewWorld

Source code excerpt:

	{
		// If this isn't set, the PerfTrackers are already allocated in the constructor
		if (bDisableInGamePerfTrackersForUninitializedWorlds && !PerfTrackers)
		{
			PerfTrackers = new FWorldInGamePerformanceTrackers();
		}

		// Initialize the world
		InitWorld(IVS);