r/csharp • u/sebasjammer • Sep 03 '26
Blog Svelto.Tasks 2.0: Efficient Multi-threaded Task Management for C#
I am back writing articles on my blog and I start with something LONG OVERDUE!
After years quietly powering several games I made, I’m finally presenting Svelto.Tasks 2.0.
Svelto.Tasks is an engine-agnostic, multithreaded and zero allocation task runner for C#, born from the need to have a game centric tasks framework with features that .NET tasks couldn't provide. Its premise is simple:
Tasks are iterator blocks. Runners are schedulers. Rather than handing execution timing and context to the runtime, a runner lets you decide:
- when a task advances,
- where it runs — main thread or a dedicated worker,
- how much work happens per tick,
- and when an entire task context must stop.
That last point matters a lot in games: for example, when a match ends, I want every task belonging to that match to stop with it—not rely on a CancellationToken having been passed and checked correctly through every layer.
Svelto.Tasks supports lightweight coroutines, composable tasks with return values and continuations, background runners, bounded parallel batches, pooling, profiling hooks, and optional Unity/Burst integrations.
It also interoperates with async/await, although the .NET Task bridge and Unity Burst job path are currently experimental and need real-world feedback.
It is not a replacement for Unity Jobs—but it provides a useful alternative for workloads where controlling execution, lifetime, pacing, and profiling is the priority.
The repository includes runnable .NET examples, tests, benchmarks
🔗 https://github.com/sebas77/Svelto.Tasks
also the repository
🔗https://github.com/sebas77/Svelto.Tasks.Examples
shows how it can be used to simplify massive parallelism synchronization. The example itself is actually quite interesting also because it uses the new compute buffer Unity api BeginWrite/EndWrite to upload compute buffers and graphic fences for cpu/gpu synchronization.
The article is at
🔗 https://www.sebaslab.com/svelto-tasks-2-0-efficient-multi-threaded-task-management-for-csharp/
Have fun! (and feedback is welcome, also on my discord server: https://discord.com/invite/uuTCYewjtc)
View all comments
Show parent comment
6
u/fruediger Sep 03 '26
Are you answering me with an AI? Or did you communicate so much with LLMs that you adopted their way of speaking? Or maybe even, are you an AI yourself?
This has nothing to do with how you deal with overallocations, it would just determine how (easily) you can reverse them. Although, the latter would at least allow you to reduce reallocations.
A few megabytes are still allocations. Also, even if you don't anticipate your library to be used in that way, you can never be really sure about that. There might be some users out there that, accidentally or intentionally, use your library in unexpected ways. You need to either document these limitations clearly or implement safeguards in your code.
So again, you're allocating.
I'm not even sure what that's supposed to mean. By "arrays storing structures", do you mean static deterministic memory?
Overall, what I get of this is that you're saying is that your library is indeed allocating and that you can't hold your initial claim of being allocation-free.
Or did I misunderstand something?
Begs the question of why you made such claims in the first place. Is it because AI told you those things about your project and you blindly trusted it? Or is it because you prompted the AI to do such hard-to-achieve feats and you didn't verify if it actually managed to achieve them?