au.streamcaching.SearchUsingChunkArray
au.streamcaching.SearchUsingChunkArray
#Overview
name: au.streamcaching.SearchUsingChunkArray
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If performing an exhaustive search of the cache, use the chunk array instead of the LRU (we give up knowing how far down the cache an element was).\n0: Search using LRU (linked list). 1: Search using Chunk Pool (TArray)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of au.streamcaching.SearchUsingChunkArray is to control the search method used for the audio streaming cache in Unreal Engine 5. This setting variable is specifically designed for the audio system, particularly the audio streaming cache subsystem.
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 AudioStreamingCache.cpp file, which is part of the Engine’s runtime.
The value of this variable is set through the Unreal Engine’s console variable system. It’s initialized with a default value of 1 and can be modified at runtime using console commands.
The associated variable SearchUsingChunkArrayCVar directly interacts with au.streamcaching.SearchUsingChunkArray. They share the same value, with SearchUsingChunkArrayCVar being the actual integer variable used in the C++ code.
Developers must be aware that this variable affects the performance and behavior of audio cache searches. When set to 1 (default), it uses a chunk array (TArray) for searching, while when set to 0, it uses a Least Recently Used (LRU) linked list.
Best practices when using this variable include:
- Understanding the trade-offs between the two search methods (chunk array vs. LRU list).
- Profiling the performance impact of each method in your specific use case.
- Being cautious when changing this value, as it can affect audio streaming performance.
Regarding the associated variable SearchUsingChunkArrayCVar:
The purpose of SearchUsingChunkArrayCVar is to provide a C++ accessible counterpart to the console variable au.streamcaching.SearchUsingChunkArray. It’s used directly in the code to determine which search method to use in the FAudioChunkCache::FindElementForKey function.
This variable is set and modified through the console variable system, specifically using the FAutoConsoleVariableRef mechanism.
SearchUsingChunkArrayCVar interacts directly with the console variable system and is used in conditional statements to determine the search behavior.
Developers should be aware that modifying SearchUsingChunkArrayCVar directly in C++ code is not recommended, as it’s intended to be controlled via the console variable system.
Best practices for SearchUsingChunkArrayCVar include:
- Treating it as read-only in most cases, relying on the console variable system for modifications.
- Using it in performance-critical code paths to make decisions about search methods.
- Considering its value when optimizing or debugging audio streaming cache performance issues.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:128
Scope: file
Source code excerpt:
static int32 SearchUsingChunkArrayCVar = 1;
FAutoConsoleVariableRef CVarSearchUsingChunkArray(
TEXT("au.streamcaching.SearchUsingChunkArray"),
SearchUsingChunkArrayCVar,
TEXT("If performing an exhaustive search of the cache, use the chunk array instead of the LRU (we give up knowing how far down the cache an element was).\n")
TEXT("0: Search using LRU (linked list). 1: Search using Chunk Pool (TArray)"),
ECVF_Default);
static int32 EnableExhaustiveCacheSearchesCVar = 0;
#Associated Variable and Callsites
This variable is associated with another variable named SearchUsingChunkArrayCVar
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:126
Scope: file
Source code excerpt:
ECVF_Default);
static int32 SearchUsingChunkArrayCVar = 1;
FAutoConsoleVariableRef CVarSearchUsingChunkArray(
TEXT("au.streamcaching.SearchUsingChunkArray"),
SearchUsingChunkArrayCVar,
TEXT("If performing an exhaustive search of the cache, use the chunk array instead of the LRU (we give up knowing how far down the cache an element was).\n")
TEXT("0: Search using LRU (linked list). 1: Search using Chunk Pool (TArray)"),
ECVF_Default);
static int32 EnableExhaustiveCacheSearchesCVar = 0;
FAutoConsoleVariableRef CVarEnableExhaustiveCacheSearches(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/AudioStreamingCache.cpp:1402
Scope (from outer to inner):
file
function FAudioChunkCache::FCacheElement* FAudioChunkCache::FindElementForKey
Source code excerpt:
{
// Otherwise, linearly search the cache.
if (SearchUsingChunkArrayCVar)
{
return LinearSearchChunkArrayForElement(InKey);
}
return LinearSearchCacheForElement(InKey);
}