Last time we saw that jobs apparently have their own
Temp allocator. Still, it was unclear how many of these allocators there are. One per job job? One per thread? Just one? Today we’ll run an experiment to find the answer!
Posts Tagged threading
Temp memory is backed by a fixed size block that’s cleared by Unity every frame. Allocations on subsequent frames return pointers to this same block. The allocated memory therefore isn’t unique. How much of a problem is this? Today we’ll do some experiments to find out!
What do you do when a job you’re writing needs to allocate memory? You could allocate it outside of the job and pass it in, but that presents several problems. You can also allocate memory from within a job. Today we’ll look into how that works and some limitations that come along with it.
Unity 2019.1 was released last week and the Burst compiler is now out of Preview. It promises superior performance by generating more optimal code than with IL2CPP. Let’s try it out and see if the performance lives up to the hype!
Last week’s article introduced two new native collection types:
NativeLongPtr. These were useful for both
IJobParallelFor jobs, but performance was degraded in
IJobParallelFor. Today we’ll remedy that, explore some more aspects of Unity’s native collection and job systems, and learn more about CPU caches along the way.
Two weeks ago we tested the performance of the
await keywords plus the C#
Task system against Unity’s new C# jobs system. This tested the usual combination of
await with the
Task system, but didn’t test the
Task system directly against Unity’s C# jobs system. Today we’ll test that and, in so doing, see how to use the
Task system without the
Last week’s article tested the performance of the
await keywords plus the C#
Task system against Unity’s new C# jobs system. This week we’ll go in depth with
await to learn how they work, how they relate to the
Task system, and how we can customize them for our own uses.
Writing multi-threaded code is one of the keys to maximizing performance. Currently, this means creating your own threads and synchronizing them with C# keywords like
volatile as well as .NET classes like
Interlocked. Today we’ll take a look at how these are implemented behind the scenes by IL2CPP to get some understanding of what we’re really telling the computer to do when we use them.
The Unity API can mostly only be used from the main thread. This is used as an excuse by Unity developers to write all their code on the main thread. This makes their code run 2-6x slower. So what can we do about it? Today’s article presents a simple way to use the Unity API from other threads. Read on to learn how to unlock all that extra CPU power!