IL2CPP player build time improvement coming to 2020.2.0b2

The process of converting .NET assemblies into C++ files has historically been single threaded. The il2cpp.exe utility performs this task.. You may have noticed the il2cpp.exe process churning along using a single core.

In the fall of 2019 we began a journey to make il2cpp.exe take advantage of all the cores your machine has available. Over the last year we have steadily shifted il2cpp.exe toward becoming a multi-threaded application.

Starting in 2020.2.0b2 the process of converting .NET assemblies into C++ files is multi-threaded.

For 6-8 core machines the conversion process will see roughly a 60-65% decrease in conversion time. On a 64 core machine conversion time decreased by 73%.

It is hard to generalize exactly what improvement you will see in the overall il2cpp player build times. There are many variables that contribute to the total player build time such as C++ compiler settings, your CPU, and more.

Broadly speaking here is what you can expect to see

  • Clean player builds will have the least perceived improvement. This is because compiling C++ files dominates the total time.

  • Incremental player builds will see the most perceived benefit because there are fewer C++ files to compile.

29 Likes

Please note that 2020.2.0b2 is currently in QA and will only be available next week (around Sept 9th)

3 Likes

2019lts can use?

1 Like

This is great news. 2020.2 looking even better!


Unfortunately no, this will only be in 2020.2+.

Are C++ files regenerated for all assemblies all the time or only the assemblies that changed?
If it is regenerated for all, do you plan to improve this?

Is this also happening for mac or is this pc only? asking because the talk is about a .exe

Are C++ files regenerated for all assemblies all the time or only the assemblies that changed?

If 1 or more assemblies are changed, all C++ files are regenerated.

If it is regenerated for all, do you plan to improve this?

It's on our radar for the future improvements.

Is this also happening for mac or is this pc only?

This applies to all platforms supported by the Editor. So yes it applies to mac.

2 Likes

The 2020.2.0b2 release with this improvement is now available: https://unity3d.com/beta/2020.2b

2 Likes

Great will check it out with my quad core macbook pro

Oh looking forward to this. I don't have cloud build or anything so this might move IL2CPP back into the realm of iteration viability. We'll see, but I hope so :smile:.

I assume that this affects WebGL Build times as well?

Sounds great, though why this slowww process was not making use of multi-threading until now I can only guess!


Yes.

2 Likes

My build times went from >3 minutes to 2:40 minutes (or 19 seconds when no code change). Nice!

Observation... when looking at CPU utilisation during IL2CPP conversion my CPU is barely utilized by 10% (R9 3900x 12c/24t). So I do have build time improvements but I don't think it's from that specific feature. Is it supposed to heavily multi-thread the process or is it light?

1 Like

In my environment WebGL build time.

2019.4: 105min
2020.2: 25min
(CPU core: 6)
And it is about 3 times faster.

2 Likes

If only the texture compression part could be made faster?
Only compress textures needed for the build and not all


Isn't Unity only building assets that end up in the build already? Can't you use the "Compress assets on import" option in the preferences to basically have zero asset compression time in the editor?

Compress on import compresses all the textures in the project, ( making the cache data base very large ) and when switching platforms it needs to compress all the textures for that platform, making switching platforms taking a long time.

I would like to make a build and then unity checks what textures are needed and only compresses those, saving disk space and time.

And ideally do it on the GPU to speed up compression time.

Right now it can take many hours and gigabytes to compress all the textures in my project but I don't even need them all compressed

https://www.youtube.com/watch?v=VF-Qe-0zXlc

Its being talked about in this video, I'm just waiting to hear more about it