Unity Performance Scaling: How Many Cores and Threads Do You Really Need?

Common Unity Developer tasks tested on various CPU configurations

Sebastian Janus
Unity Tips and Tricks
5 min readMay 12, 2023

--

Unity is a popular game development engine that allows developers to create high-quality games for multiple platforms. As a Unity developer, I was interested in measuring the performance of various tasks commonly performed during game development. Specifically, the number of CPU cores and threads can significantly affect Unity Editor performance. The tests were performed in August 2020 on Unity 2018.4.25f1 (LTS), but the results were never released until now (May 2023).

Test Setup

Hardware Specifications

CPU: AMD Ryzen 5 3600 with various cores and threads configuration set by Ryzen Master software
Motherboard: Asus PRIME B350-PLUS
SSD: Adata XPG SX8200 Pro NVMe 1TB
RAM: Corsair Vengeance LPX DDR4 3000 C16 2x16GB
OS: Windows 10

Test Project

Test project was base on the Adventure — Sample Game by Unity Technologies, which is available on the Unity Asset Store. This project includes complete 3D adventure game with all the necessary elements, including characters, enviroments and animations.

Adventure — Sample Game by Unity Technologies

Test Methodology

I measured the time required for the following Unity developer tasks:

  1. Mobile platform switching
  2. Build time
  3. Scripts compilation time
  4. Texture compression using the FruitVendorAlbedo texture at 2048x2048 resolution with the following compression types:
    - ETC2 normal/best
    - ETC2-crunched normal/best
    - PVRTC normal/best
    - ASTC8x8 normal/best

Each test was conducted at least three times, and we averaged the results.

The following CPU cores (C) and threads (T) configurations were tested:
- 2C/2T
- 2C/4T
- 4C/4T
- 4C/8T
- 6C/6T
- 6C/12T

Results

My tests showed that the number of CPU cores and threads can have a significant impact on Unity’s performance.

There are two charts for each test, first one with absolute numbers indicating time in seconds needed to complete the task (the lower the better). Then, there is a relative performance gain chart, where 2C/2T CPU configuration is used as baseline (100%).

Mobile Platform Switching

Mobile platform switching involves switching between Android and iOS platforms. This task is one of the longest ones happening in Unity Editor.

Platform Switching time (in seconds)
Platform Switching relative performance gain (percentage)

Our tests showed that mobile platform switching times decreased as the number of CPU cores and threads increased. Increasing the number of cores results in a significant performance gain, with a smaller improvement seen when multithreading is enabled. Performance gain grows almost linearly with cores count, hitting almost 300% with 6C/12T instead of 2C/2T.

Build Time

Build time is the time required to build the game for a specific platform. It was time needed to create *.aab file for Android platform, and to export XCode project for iOS platform. On iOS you should also include time needed to compile XCode project into *.xarchive, however you cannot do that on windows.

Mobile Build Time (in seconds)
Mobile Build Time relative performance gain (percentage)

As you can see this task wasn’t boosted by increasing a core count. Probably there wasn’t enough easily threaded work in this project to get benefits from a better cpu, maximum gain was about 10%.

Scripts Compilation Time

Scripts compilation time is the time required to compile the scripts. I was doing changes to scripts in main script assembly, and to plugins assembly as well in second test. Recompilation time is quite short task, however it is done really frequently during game development.

Scripts Compilation Time (in seconds)
Scripts Compilation relative performance gain (percentage)

You can see that this task get some advantage from increasing cores and threads count, however it is not that much as in Platform Switching time. Although increasing the number of cores and threads provides some benefit for this task, the maximum improvement is only around 130–150%. It’s worth noting that the overall time savings are relatively small, reducing the task from 5.1 seconds to 3.5 seconds.

Texture Compression

ETC2 and ETC2 + Crunch compression

Texture compression involves compressing textures using different compression types. I’ve tested ETC2 and ETC2 with crunch compression which is a technique of lossy compression to decrease not only memory size of textures, but also filesize.

Texture Compression time (in seconds) — ETC2 (normal/best) and ETC2 + Crunch (normal/best)
Texture Compression performance gain (percentage) — ETC2 (normal/best) and ETC2 + Crunch (normal/best)

PVRTC and ASTC

In addition, there is PVRTC compression which was popular on oldes iOS devices (supported mainly by PowerVR GPUs), and lastly, ASTC 8x8 compression which is the most modern one, and requires the most modern hardware.

Texture Compression time (in seconds) —PVRTC (normal/best) and ASTC 8x8 (normal/best)
Texture Compression performance gain (percentage) — PVRTC (normal/best) and ASTC 8x8 (normal/best)

In these tests, we see consistent improvements as we increase the number of cores and threads. The 6C/12T configuration again shows the most improvement, with over a double increase in speed for 4C/8T and over a threefold increase with 6C/12T configuration compared to the baseline.

Here’s the 2048x2048 texture used for compression time tests:

FruitVendorAlbedo.png — texture used for compression time tests

Conclusion

There are two fields that clearly take linear advantages of using CPU with greater cores and threads count: texture compression and project switching. The latter probably because it depends heavily on reimporting assets, which is easily multithreaded, and also depends on changing texture compression for all the image files in project.

There was some improvement in building times and script compilation times, however it looked like these task are more single threaded, and they probably would benefit more from higher cpu clocks or choosing a cpu with greater single threaded performance.

If you are considering purchase of a CPU for Unity developing purposes, you can clearly see that there are always performance gains. In some tasks these are linearly growing with core count, in other it’s not that obvious, however these performance gains still occur.

Please take into consideration, that these test were done in 2020, using Unity 2018. The newest Long Term Support version at the time of writing (05.2023) is Unity 2021.3. In newer versions there could be more optimizations of building process, that could benefit more from increased core count.

If you would like to see updated version of that test, or you would like to see some other common tasks to be tested, just let me know in the comments section below.

--

--

Sebastian Janus
Unity Tips and Tricks

Senior Unity Games Developer at Byss Mobile, Board Games and Miniatures Hobbyst, Father and a Padel Player