IL2CPP - slow performance

After upgrading game to 64-bit(google requirement) the performance of game went down at least 10 times. While 32-bit version of game performs without any problem even on cheap mobiles(100$ worth). Is there any chance to solve this issue?

I’m trying to debug the game now but it’s very difficult, every apk generation takes more then 5 mins.

Any ideas?

1 Like

Same here , Any solution …?

Bump! I wanted to create a thread with almost the exact same words the OP uses! In my case though the game begins with a smooth FPS but suddenly drops to about half the amount after a while. Testing with mono builds gives no such issue indicating that this is not a result of a leakage of some sort.

This sounds like thermal throttling.

But why does it only happen with IL2CPP? Also i can’t feel much heat from the device. Even locking the phone while the game is running and coming back to it in few minutes (supposedly letting the phone cooldown) does not give a higher fps. But say this was the cause… how would i go on about fixing it? i literally wanna try anything to get rid of this issue as soon as possible

Did you check the adb logcat to see if there are errors or warnings?

This is a known issue and we are working on a fix. Unity Issue Tracker - [Android] [il2cpp] Performance regression in 64-bit builds due to StackTrace API
The problem is that stack walking is much slower on 64 bit. Take a look at your project if you have any Debug.Log calls and if you have them, then comment them out or remove them. That is a temporary workaround.

1 Like

Interesting. just tested it and it seens removing the Debug.Logs fixed the performance issue.

Could I get this fix on 2018 LTS?

Sadly, due big code differences 2018 versus 2019, the fix won’t be backported to 2018, you either need to disable/remove Debug.Log* functions or alternatively go to Player Settings and set StacktraceLogType to None for every Error type.

1 Like

Same problem I saw this on profiler the problem is not in rendering but in scripting.

In my experience retrieving the stack trace in Unity can be very slow on consoles too, so not only Android. So you might want to have a build preprocessor script that disables stack traces for non-expection log messages.

For console platforms, where shipping builds don’t wrote to the log output at all, we use a wrapper to the Debug class which uses conditional attributes to strip the calls in shipping builds (since Unity would still have to build the log messages that go nowhere).

If you do use some sort of custom log interception (like remote logging) and needs the call stacks, you have to be judicious with your logging and avoid logging every frame and similar.

1 Like