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!
Posts Tagged threading
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!
Coroutines are great for tasks that are easy to break up into little chunks, but we still need threads for long-running blocking calls. Today’s article shows how you can mix some threads into your coroutines to easily combine these two kinds of asynchronous processes.
The last article gave a very basic example of the
flash.concurrent.Condition class introduced in Flash Player 11.5. That example was (hopefully) a simple and easy way to understand the mechanics of how the
Condition class works. Unfortunately, it was not a useful example and actually demonstrated the opposite of what you’d want to use it for. Today’s article shows a somewhat more complicated example that should serve as an example of appropriate usage for