AsyncTaskBatchSize

AsyncTaskBatchSize

#Overview

name: AsyncTaskBatchSize

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 9 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of AsyncTaskBatchSize is to control the size of batches for asynchronous processing in the Find-in-Blueprint (FiB) system of Unreal Engine 5. This variable is primarily used for managing the indexing and caching of Blueprint assets for search operations.

AsyncTaskBatchSize is mainly used in the Find-in-Blueprint manager, which is part of the Kismet module in Unreal Engine’s editor subsystem. This module is responsible for handling Blueprint-related operations and searches.

The value of this variable is set in two ways:

  1. It’s initialized to 0 in the FFindInBlueprintSearchManager constructor.
  2. It’s loaded from the GEditorIni configuration file during the Initialize() function of FFindInBlueprintSearchManager.

AsyncTaskBatchSize interacts with other variables and functions within the FCacheAllBlueprintsTickableObject class, which handles the caching of Blueprint assets. It’s used to determine how many assets should be processed in each batch during asynchronous operations.

Developers should be aware that:

  1. If AsyncTaskBatchSize is set to 0 or a negative value, it defaults to processing all uncached assets in a single batch.
  2. This variable directly affects the performance and responsiveness of the Blueprint caching process.

Best practices when using this variable include:

  1. Setting an appropriate value based on the project’s size and available system resources. A larger value will process more assets at once but may impact editor performance.
  2. Consider adjusting this value if experiencing performance issues during Blueprint searches or asset caching.
  3. Use the GEditorIni configuration file to set a project-specific value that suits your team’s workflow.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditor.ini:537, section: [BlueprintSearchSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:1508

Scope (from outer to inner):

file
class        class FCacheAllBlueprintsTickableObject : public IAsyncSearchIndexTaskController

Source code excerpt:


		/** Size of each batch (for async processing) */
		int32 AsyncTaskBatchSize;

		FCacheParams()
			:OpFlags(EFiBCacheOpFlags::None)
			,AsyncTaskBatchSize(0)
		{
		}
	};

	FCacheAllBlueprintsTickableObject(const TSet<FSoftObjectPath>& InAssets, const FCacheParams& InParams)
		: UncachedAssets(InAssets.Array())

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:1526

Scope (from outer to inner):

file
class        class FCacheAllBlueprintsTickableObject : public IAsyncSearchIndexTaskController
function     FCacheAllBlueprintsTickableObject

Source code excerpt:

		, bIsCancelled(false)
	{
		if (CacheParams.AsyncTaskBatchSize <= 0)
		{
			CacheParams.AsyncTaskBatchSize = UncachedAssets.Num();
		}

		if (EnumHasAnyFlags(CacheParams.OpFlags, EFiBCacheOpFlags::ShowProgress)
			&& !EnumHasAnyFlags(CacheParams.OpFlags, EFiBCacheOpFlags::HideNotifications))
		{
			// Start the Blueprint indexing 'progress' notification

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:1642

Scope (from outer to inner):

file
class        class FCacheAllBlueprintsTickableObject : public IAsyncSearchIndexTaskController
function     virtual bool IsWorkPending

Source code excerpt:

		}

		const int32 AsyncTaskBatchSize = CacheParams.AsyncTaskBatchSize;
		const int32 StartIndex = AsyncTaskBatchIndex * AsyncTaskBatchSize;
		return StartIndex < UncachedAssets.Num() || !AssetsPendingGatherQueue.IsEmpty() || !AssetsPendingAsyncIndexing.IsEmpty() || bIsGatheringSearchMetadata;
	}

	virtual bool ShouldFullyIndexAssets() const override
	{
		return !EnumHasAnyFlags(CacheParams.OpFlags, EFiBCacheOpFlags::ExecuteGatherPhaseOnly);

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:1674

Scope (from outer to inner):

file
class        class FCacheAllBlueprintsTickableObject : public IAsyncSearchIndexTaskController
function     virtual void GetAssetPathsToIndex

Source code excerpt:

		OutAssetPaths.Empty();

		const int32 AsyncTaskBatchSize = CacheParams.AsyncTaskBatchSize;
		const int32 StartIndex = AsyncTaskBatchIndex * AsyncTaskBatchSize;
		if (StartIndex < UncachedAssets.Num())
		{
			for (int32 i = StartIndex; i < FMath::Min(StartIndex + AsyncTaskBatchSize, UncachedAssets.Num()); ++i)
			{
				OutAssetPaths.Add(UncachedAssets[i]);
			}

			AsyncTaskBatchIndex++;
		}

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:1689

Scope (from outer to inner):

file
class        class FCacheAllBlueprintsTickableObject : public IAsyncSearchIndexTaskController
function     virtual void GetAssetPathsToIndex

Source code excerpt:

			FSoftObjectPath AssetPath;
			int32 Count = 0;
			while (Count < AsyncTaskBatchSize && AssetsPendingAsyncIndexing.Dequeue(AssetPath))
			{
				OutAssetPaths.Add(AssetPath);
				++Count;
			}
		}
	}

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:2036

Scope (from outer to inner):

file
function     FFindInBlueprintSearchManager::FFindInBlueprintSearchManager

Source code excerpt:

	: AssetRegistryModule(nullptr)
	, CachingObject(nullptr)
	, AsyncTaskBatchSize(0)
	, bIsPausing(false)
	, bHasFirstSearchOccurred(false)
	, bEnableGatheringData(true)
	, bDisableDeferredIndexing(false)
	, bEnableCSVStatsProfiling(false)
	, bEnableDeveloperMenuTools(false)

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:2079

Scope (from outer to inner):

file
function     void FFindInBlueprintSearchManager::Initialize

Source code excerpt:

{
	// Init configuration
	GConfig->GetInt(TEXT("BlueprintSearchSettings"), TEXT("AsyncTaskBatchSize"), AsyncTaskBatchSize, GEditorIni);
	GConfig->GetBool(TEXT("BlueprintSearchSettings"), TEXT("bDisableDeferredIndexing"), bDisableDeferredIndexing, GEditorIni);
	GConfig->GetBool(TEXT("BlueprintSearchSettings"), TEXT("bDisableThreadedIndexing"), bDisableThreadedIndexing, GEditorIni);
	GConfig->GetBool(TEXT("BlueprintSearchSettings"), TEXT("bEnableCsvStatsProfiling"), bEnableCSVStatsProfiling, GEditorIni);
	GConfig->GetBool(TEXT("BlueprintSearchSettings"), TEXT("bEnableDeveloperMenuTools"), bEnableDeveloperMenuTools, GEditorIni);
	GConfig->GetBool(TEXT("BlueprintSearchSettings"), TEXT("bDisableSearchResultTemplates"), bDisableSearchResultTemplates, GEditorIni);
	GConfig->GetBool(TEXT("BlueprintSearchSettings"), TEXT("bDisableImmediateAssetDiscovery"), bDisableImmediateAssetDiscovery, GEditorIni);

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Private/FindInBlueprintManager.cpp:3202

Scope (from outer to inner):

file
function     void FFindInBlueprintSearchManager::CacheAllAssets

Source code excerpt:

		{
			CacheParams.OnFinished = InOptions.OnFinished;
			CacheParams.AsyncTaskBatchSize = AsyncTaskBatchSize;

			// Determine if PIE is active - in that case we're potentially streaming assets in at random intervals, so just hide the progress UI while re-indexing those assets
			const bool bIsPIESimulating = (GEditor->bIsSimulatingInEditor || GEditor->PlayWorld);

			// Display progress during a re-indexing operation only if we have multiple assets to process (e.g. avoid showing after compiling a single asset) and we're not in PIE
			if ((PendingAssets.Num() > 1) && !bIsPIESimulating)

#Loc: <Workspace>/Engine/Source/Editor/Kismet/Public/FindInBlueprintManager.h:871

Scope (from outer to inner):

file
class        class FFindInBlueprintSearchManager : public FTickableEditorObject

Source code excerpt:


	/** Size of a single async indexing task batch; zero or negative means that a caching operation will consist of a single batch */
	int32 AsyncTaskBatchSize;

	/** TRUE when the the FiB manager wants to pause all searches, helps manage the pausing procedure */
	TAtomic<bool> bIsPausing;

	/** Currently used to delay the full indexing pass until the first search in order to control memory usage */
	TAtomic<bool> bHasFirstSearchOccurred;