Misaki.HighPerformance.Jobs
3.2.0
dotnet add package Misaki.HighPerformance.Jobs --version 3.2.0
NuGet\Install-Package Misaki.HighPerformance.Jobs -Version 3.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Misaki.HighPerformance.Jobs" Version="3.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Misaki.HighPerformance.Jobs" Version="3.2.0" />
<PackageReference Include="Misaki.HighPerformance.Jobs" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Misaki.HighPerformance.Jobs --version 3.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Misaki.HighPerformance.Jobs, 3.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Misaki.HighPerformance.Jobs@3.2.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Misaki.HighPerformance.Jobs&version=3.2.0
#tool nuget:?package=Misaki.HighPerformance.Jobs&version=3.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Misaki.HighPerformance.Jobs
A zero-allocation-oriented job system for C#.
This package provides job contracts, scheduling, worker threads, and dependency handling for high-throughput work execution.
What it includes
- single-job execution
- parallel-for job execution
- parallel range jobs
- job handles and dependency tracking
- worker thread management
Highlights
- designed to minimize allocations during scheduling and execution
- supports dependency composition and wait operations
- suitable for frame-based engines, simulations, batch processing, and custom runtimes
- integrates with the low-level allocation layer
Main types
IJobIJobParallelForIJobParallelJobSchedulerJobHandleJobExecutionContextJobStateWorkerThread
Example
IJob example
using Misaki.HighPerformance.Jobs;
public struct AddJob : IJob
{
public int* pA;
public int* pB;
public int* pResult;
public void Execute(ref readonly JobExecutionContext ctx)
{
*pResult = *pA + *pB;
}
}
JobSchedulerDesc desc = new JobSchedulerDesc
{
ThreadCount = Environment.ProcessorCount,
ThreadPriority = ThreadPriority.Normal,
DependencyChainCapacity = 64,
};
JobScheduler jobScheduler = new JobScheduler(in desc);
int a = 5;
int b = 10;
int result = 0;
AddJob job = new AddJob
{
pA = &a,
pB = &b,
pResult = &result
};
JobHandle handle = jobScheduler.Schedule(job);
jobScheduler.Wait(handle);
Console.WriteLine($"Result: {result}"); // Output: Result: 15
IJobParallelFor example
using Misaki.HighPerformance.Jobs;
public struct MultiplyJob : IJobParallelFor
{
public int[] a;
public int[] b;
public int[] result;
public void Execute(int index, ref readonly JobExecutionContext ctx)
{
result[index] = a[index] * b[index];
}
}
int[] a = { 1, 2, 3, 4 };
int[] b = { 5, 6, 7, 8 };
int[] result = new int[4];
MultiplyJob job = new MultiplyJob
{
a = a,
b = b,
result = result
};
JobHandle handle = jobScheduler.ScheduleParallelFor(job, a.Length, 4);
jobScheduler.Wait(handle);
Custom job
public unsafe struct CustomJob : ICustomJob<CustomJob>
{
public int* value;
public static void Execute(ref CustomJob job, ref JobRanges jobRanges, ref readonly JobExecutionContext ctx)
{
*job.value += 1;
}
public static void Free(ref CustomJob job)
{
// No resources to free in this example.
}
}
int value = 0;
CustomJob customJob = new CustomJob
{
value = &value
};
CustomJobDesc<CustomJob> customJobDesc = new CustomJobDesc<CustomJob>
{
data = ref customJob,
pExecutionFunc = &CustomJob.Execute,
pFreeFunc = &CustomJob.Free,
jobRanges = JobRanges.Single,
priority = JobPriority.Normal,
};
JobHandle customJobHandle = jobScheduler.ScheduleCustom(ref customJobDesc);
jobScheduler.Wait(customJobHandle);
Package reference
dotnet add package Misaki.HighPerformance.Jobs
Notes
This project targets net10.0, enables unsafe code, and is packaged as content files for downstream consumption.
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Misaki.HighPerformance (>= 1.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Misaki.HighPerformance.Jobs:
| Package | Downloads |
|---|---|
|
Misaki.HighPerformance.Mathematics.SPMD
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.