I have a reasonably large project (A few hundred scripts, a few dozen scenes) using HDRP. Today I was curious whether I would see any performance changes if I switched the project over to il2cpp from mono. After making release builds of the project using both scripting backends, I compared the performance and found no perceivable difference between the two. I compared FPS, as well as level load times.
I keep seeing vague mentions of il2cpp being “faster” in theory. My game uses a lot of physics, along with background jobs using Burst. I supposed it’s possible that I’ve already got the very expensive code in my project running in Burst, so maybe not as much room for improvement when switching the remaining code to IL2CPP. But I was curious whether anyone could give some specific cases where they’ve observed il2cpp outperforming mono. So far I figured I’ll be sticking with mono, as I see no benefit currently to going with il2cpp. (I’m targeting PC and Mac in my project.)
I recommend to hook up the profiler in builds (editor performance is not different with il2cpp). Then you can compare the absolute CPU time your scripts take up.
IL2CPP should be faster and if code cannot be converted to C++ it will just stay as C#.
From my experience, there almost always is some kind of performance improvements for the CPU, but depending on the project not always noticeable. For my Oculus Quest game it went from 15 to 30 fps, which got rid of the CPU bottleneck which was amazing.
So basically the only downside is longer build times and slightly more build size (which for most games is not noticeable since code isn’t the main storage filler)
I don’t have any specifics. I have heard il2cpp is more secure. I’ve also heard you can change the c++ compilation to master over release and gain some performance. But these are just things I’ve read and currently can’t remember where.
But my main question is. If you aren’t seeing a difference between the two, why would you stick with mono over il2cpp? You’ve mentioned you’ve done release builds of both mono and il2cpp, so you know you have it working under both. il2cpp is also considered the better of the two. My personal suggestion would be go with it instead of sticking with mono. At least this way you future proof yourself. For example, if you ever decide to do Android builds, mono can’t do 64 bit builds. il2cpp can.
Yeah I also always stick to il2cpp. If you have a decent code base it can be interesting to look into profiling builds to see performance differences.
The only downside is longer and slightly bigger builds, which is only for devs and not consumers.
And 64 bit is huge indeed!
Mainly because that’s what I’ve been using in this project for about 4 years, and it’s risky (and possibly time consuming) to make major changes to a project at this point in the lifecycle. I’m not very familiar with il2cpp, I don’t know the potential pitfalls, etc, so I wouldn’t want to make a major change to the project unless there was a really compelling reason.
So far, I haven’t observed any performance differences, and the only major change is somewhat longer build times. So, at this point, I’ve only seen downsides to switching. I’ll possibly circle back to il2cpp in the future, but I’m not currently experiencing any headaches due to being on mono.
Did you look at the profiler? If you’re GPU bottlenecked better CPU performance won’t change fps, but that doesn’t mean it’s the same cpu performance. On PC there are a ton of different comfigs, some with weak CPUs and good GPUs.
On android/mobile battery life should be better with il2cpp cause less cpu usage
No, I didn’t look at the profiler. And before that sounds lazy/ignorant, my whole reason for pursuing il2cpp was for noticeable, real-world performance gains. I played through an il2cpp build of my game, under various graphics settings (that is, force either GPU or CPU bottlenecks depending on how high I cranked the graphics), and it didn’t appear to make any difference in any of my levels compared to a mono build of the game. At that point, I don’t see what value the profiler would provide. I’m not really interested in whether some select bit of code runs a bit faster under il2cpp, when it doesn’t provide noticeable performance differences in the game on the whole.
This also isn’t a mobile game, so any compatibility/battery benefits aren’t relevant.
Anyway, my evaluation for now is that I’ll table il2cpp, maybe revisit it the next time I do a major upgrade of the Unity version, in case there’s any difference in newer Unity engine releases.
Fair enough. I still think it’s worth looking into the profiler, so you can check actual real world data instead of fps numbers. Note that some people have an fx 4300 and gtx 1080 or something like that, which could definitely hit the CPU different