Click or drag to resize

JobsUtilitiesGetOptimalBatchCountForProcessorsT Method

Determines how to distribute a job based on the desired minimum items to run per job and logical cpu cores available to the .NET runtime.

Namespace:  DustProductions.Core
Assembly:  DustProductions.Core (in DustProductions.Core.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public static int GetOptimalBatchCountForProcessors<T>(
	this NativeArray<T> nativeArray,
	int desiredMinimumInBatch = 16
)
where T : struct, new()

Parameters

nativeArray
Type: NativeArrayT
A NativeArray whose length will be used to determine batch size.
desiredMinimumInBatch (Optional)
Type: SystemInt32
Because we don't really know what sort of work is being done, you can optionally pass in the minimum number of items per batch. Defaults to 16.

Type Parameters

T
The type of object in the NativeArray.

Return Value

Type: Int32
The number of items per batch for a nice (mostly) even distribution of items for the job.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type NativeArrayT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also