Search Unity

Old habits and IL2CPP

Discussion in 'Scripting' started by besttof, May 20, 2015.

  1. besttof

    besttof

    Joined:
    Jul 17, 2012
    Posts:
    29
    Now that IL2CPP is "out" how many of the old performance considerations (for example: https://andrewfray.wordpress.com/2013/02/04/reducing-memory-usage-in-unity-c-and-netmono/ and http://www.gamasutra.com/blogs/Wend...nagement_for_Unity_Developers_part_1_of_3.php) still hold up?

    I'm especially curious about the garbage generation by foreach loops and linq functionality; does the current IL2CPP affect the short lived object generation/collection at all? Or is that something that'll be added to IL2CPP in the future?
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,332
    IL2CPP is a different way of compiling the code. The problems with foreach and linq has to do with the Mono implementation, as it has to do with generating an iterator object to iterate through collections. If I have understood how things work correctly, that is long before the IL2CPP process even begins, so unless Unity has done some upgrades of their Mono fork, those problems should still be around.

    I've also seens some hints that the whole debacle with Unity's Mono being kinda S*** won't be fixed until after IL2CPP is stable, but don't take my word for it. It would be nice if it happened, though.

    Also note that the foreach creating garbage thing isn't supposed to happen if you're iterating over arrays, as the compiler is suposed to just magic that into a for-loop anyways. It's when you're iterating over collections that doesn't support indexing.