Search Unity

il2cpp + new input system + XR (quest via link) = very slow

Discussion in 'General Discussion' started by mk1987, May 17, 2021.

  1. mk1987

    mk1987

    Joined:
    Mar 18, 2019
    Posts:
    53
    Hi there,

    I've been having a lot of problems regarding performance of my game recently, decided i would break everything down one by one and rebuild it from the base scripts and assets and see what problems are occuring.

    In both i was having problems with the new input system, I moved to this primarily because i wanted to use OpenXR instead of using oculus (number of headsets is increased!) but i was getting a lot of editor crashing due to that and thus reverted to oculus but kept the new input system.

    In order to benchmark the performance potential of the game i moved to il2cpp for build. In my rebuilt game within the editor im getting great performance now as you can see below, most of the time is the early frame bit which is just what i think of as VR vsync to in this case 72fps, my code takes up roughly 0.5ms in this state.

    However making a non mono build my code first of all goes from 0.5ms to 2ms (i appreciate i may have interface calls and my code isn't suitable for il2cpp, as described in https://forum.unity.com/threads/il2cpp-super-slow-vs-mono-standalone.932499/) but the biggest impact is the input system which goes from 0.1ms in total to around 10ms. Whilst i can appreciate my code may be slower, im not understanding why the inbuilt packages would be going slower as well. I've tried input systems v1.02 verified and 1.1.0preview 3 with the same result.

    Im using .net standard 2.0, would there be any performance benefit or recoding effort if i went to .net4.x? I've tried incremental GC on and off.

    Worst case i can stick with mono as i think i can get it to run at full pace now when my assets are reintegrated but would be nice to know what my options are.

    Thanks for any help you can give me.

    Profiler.png