au.streamcaching.EnableExhaustiveCacheSearches
au.streamcaching.EnableExhaustiveCacheSearches
#Overview
name: au.streamcaching.EnableExhaustiveCacheSearches
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables an exhaustive search of the cache in FindElementForKey.\n0: Rely on chunk offset. 1: Search using linear search
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.streamcaching.EnableExhaustiveCacheSearches is to control the search method used in the audio streaming cache system of Unreal Engine 5. It is specifically designed for the audio subsystem, particularly the audio streaming cache functionality.
This setting variable is primarily used in the Engine module, specifically within the audio streaming cache implementation. Based on the callsites, it’s clear that this variable is utilized in the FAudioChunkCache class, which is part of the audio streaming system.
The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 and can be changed at runtime using the console command “au.streamcaching.EnableExhaustiveCacheSearches”.
The associated variable EnableExhaustiveCacheSearchesCVar directly interacts with au.streamcaching.EnableExhaustiveCacheSearches. They share the same value, with EnableExhaustiveCacheSearchesCVar being the actual integer variable used in the code logic.
Developers must be aware that this variable affects the performance and behavior of the audio streaming cache system. When enabled (set to 1), it triggers an exhaustive search of the cache in the FindElementForKey function, which may impact performance but potentially improve cache hit rates.
Best practices when using this variable include:
- Keep it disabled (0) by default for optimal performance.
- Enable it (1) only when debugging cache-related issues or when you need to ensure the most accurate cache searches at the cost of performance.
- Monitor performance metrics when enabling this feature, especially in performance-critical scenarios.
Regarding the associated variable EnableExhaustiveCacheSearchesCVar:
The purpose of EnableExhaustiveCacheSearchesCVar is to serve as the actual integer variable that stores the value of the au.streamcaching.EnableExhaustiveCacheSearches console variable.
This variable is used directly in the Engine module, specifically in the FAudioChunkCache::FindElementForKey function of the audio streaming cache system.
Its value is set through the console variable system and is directly linked to au.streamcaching.EnableExhaustiveCacheSearches.
EnableExhaustiveCacheSearchesCVar interacts directly with the logic in the FindElementForKey function, determining whether an exhaustive search of the cache should be performed.
Developers should be aware that modifying EnableExhaustiveCacheSearchesCVar directly in the code is not recommended, as it’s intended to be controlled via the console variable system.
Best practices for EnableExhaustiveCacheSearchesCVar include:
- Treat it as a read-only variable in the code.
- Use the console variable au.streamcaching.EnableExhaustiveCacheSearches to modify its value during runtime or debugging.
- Consider adding debug logging when this variable is checked to help track its usage and impact on performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:136
Scope: file
Source code excerpt:
static int32 EnableExhaustiveCacheSearchesCVar = 0;
FAutoConsoleVariableRef CVarEnableExhaustiveCacheSearches(
TEXT("au.streamcaching.EnableExhaustiveCacheSearches"),
EnableExhaustiveCacheSearchesCVar,
TEXT("Enables an exhaustive search of the cache in FindElementForKey.\n")
TEXT("0: Rely on chunk offset. 1: Search using linear search"),
ECVF_Default);
static FAutoConsoleCommand GFlushAudioCacheCommand(
#Associated Variable and Callsites
This variable is associated with another variable named EnableExhaustiveCacheSearchesCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:134
Scope: file
Source code excerpt:
ECVF_Default);
static int32 EnableExhaustiveCacheSearchesCVar = 0;
FAutoConsoleVariableRef CVarEnableExhaustiveCacheSearches(
TEXT("au.streamcaching.EnableExhaustiveCacheSearches"),
EnableExhaustiveCacheSearchesCVar,
TEXT("Enables an exhaustive search of the cache in FindElementForKey.\n")
TEXT("0: Rely on chunk offset. 1: Search using linear search"),
ECVF_Default);
static FAutoConsoleCommand GFlushAudioCacheCommand(
TEXT("au.streamcaching.FlushAudioCache"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:1399
Scope (from outer to inner):
file
function FAudioChunkCache::FCacheElement* FAudioChunkCache::FindElementForKey
Source code excerpt:
}
if (EnableExhaustiveCacheSearchesCVar)
{
// Otherwise, linearly search the cache.
if (SearchUsingChunkArrayCVar)
{
return LinearSearchChunkArrayForElement(InKey);
}