Search Unity

2 apk: same code, different libil2cpp.so, big framerate gap

Discussion in 'Android' started by benbenmushi, Jul 2, 2020.

  1. benbenmushi

    benbenmushi

    Joined:
    Jan 29, 2013
    Posts:
    34
    Hello fellow developers,

    Two builds made with the exact same sources can result in different libil2cpp.so files.
    The two libil2cpp.so files have the same content (classes/method) but thoses are not ordered the same way.

    Although this does not impact directly errors and crashes, it has a VERY negative effect on our frame-rate (from 30fps to 15fps in some cases).
    A level in our game last for about 2-3min. For some reason the frame-rate get worse after each level.
    With each release we are forced to rebuild the game until we find that sweet spot (normal performance).

    This only happend with il2cpp. The performances are good with Mono but it's not our release target.

    At first we had doubt that the performance issue was caused by the il2cpp generation.
    To test the theory we took two APK:
    • apk A (good performance)
    • apk B (bad performance)
    I extracted the files libil2cpp.so from both apk.
    Then I interchanged the libil2cpp.so files between the apk.
    Then I re-signed them and tested them to see if the performance were aligned with the libil2cpp.so location:
    • apk A with libil2cpp from B (bad performance)
    • apk B with libil2cpp from A (good performance)
    The results confirmed that the performance issue was linked to the libil2cpp.so only.

    Note:
    When using the 'development build' option, performances are always good. Making it very hard to debug.

    TL;DR

    IL2CPP randomly harm the performance of our game: from 30fps to 15fps. Forcing us to rebuild the game until we randomly find a sweet spot were planet are aligned.

    Could someone / Unity elaborate on this issue?
    Is there any way to garantee the consistency of il2cpp generated adresses for a given code base ?


    UnityVersion: 2017.4.x
    Target: Android-arm-IL2CPP
     
    Last edited: Jul 2, 2020
  2. cultzone

    cultzone

    Joined:
    Oct 20, 2019
    Posts:
    39
    can you check the versions of the Java? The JDK-SDK-NDK re too bad for us...
     
  3. benbenmushi

    benbenmushi

    Joined:
    Jan 29, 2013
    Posts:
    34
    Hello @cultzone,

    could you elaborate on what you said ?
    Also note that this issue happen on multiple builders (macOS) which share the same version of SDK, JDK, NDK.
     
  4. cultzone

    cultzone

    Joined:
    Oct 20, 2019
    Posts:
    39
    the versions of JDK are one
    the version of NDK re other
    and the version of SDK is other...
     
  5. cultzone

    cultzone

    Joined:
    Oct 20, 2019
    Posts:
    39
    is the option of monodevelop unlike il2cpp available?
    the technology for IL2CPP is for the windowsphone, Dot.net and C# and can a problem for the apple