Ilumina, a C# runtime for Unity

Hey! You can find me on Mastodon, Bluesky, and Twitter!

I have spent a lot of time this year working on Ilumina, an AOT C# runtime for Unity to replace IL2CPP. This is an announcement of sorts, I guess!

What is Ilumina?

Ilumina is a commercial plug-and-play replacement for IL2CPP. It is a successor to cpp2better and provides whole-program optimization for Unity games for final builds, so you get faster games with more predictable memory usage.

Why should you care?

In short: Faster games, lower memory usage, fewer (maybe no!) GC stalls. Long term, smaller distribution sizes are a goal as well. Get rid of Burst at runtime without sacrificing much performance. If needed, get custom fixes and improvements for your specific game to address your specific bottlenecks in C# code.

IL2CPP leaves a lot on the table in pretty much all dimensions. With cpp2better, I have already shown that in many cases you can get substantially better runtime performance by making tweaks to its codegen. However, there are limitations in the C++-rewriting approach that cpp2better is taking and Ilumina allows me to do whatever I want with the runtime. Or even whatever you want because you have a much better shot at convinicing me to change something than Unity :)

With Unity 7, Burst continues to become less relevant in the editor because CoreCLR is so much faster than Mono. Ilumina (among many, many other things) gives you codegen that can compete with Burst in many cases and will allow you to ditch Burst with its excruciatingly long compile times in many cases.

What are my goals with Ilumina?

Short term: Provide an alternative to IL2CPP that is both faster and leaner at runtime. It is more predictable in terms of memory usage and aggressively optimized.

Medium term: Ilumina is a better choice that IL2CPP in all aspects except incremental builds and development builds.

Long term: Maybe do C# outside of Unity if there is a business case for it (tell me if there is!). Maybe work on incremental builds and development builds.

What is the current state of Ilumina?

Ilumina is already in a state where it can run Unity games. Its GC implementation is heavily work-in-progress. Ilumina is currently hence only suitable for first testing (because it does not collect garbage yet). Platforms outside of Windows and Linux are currently not well-tested as well. Ilumina currently supports Unity 2022.3, 6.x, and 7.x.

If you are interested in testing Ilumina, please get in touch (mail@s-schoener.com).

Why just Unity and not C# in general?

The honest answer is that it is a lot of work and it is unclear how much value it brings.

In more technical terms: A C# runtime consists of more moving pieces than you would expect. One of these pieces is the Base Class Library (BCL). The BCL depends heavily on the runtime to implement its basic functionality (like threading, allocation, etc.). Unity is running a BCL from Mono, and CoreCLR has its own BCL. Supporting both BCLs (or alternatively, maintaining your own BCL) is a substantial piece of work.

What happens with cpp2better?

Nothing changes for cpp2better! It’s still supported and running in many games. Get in touch if you are interested in that.

Share: X (Twitter) Facebook LinkedIn