Search Unity

DataComponent size Analyzer

Discussion in 'Entity Component System' started by maxim-zaks, Sep 27, 2019.

  1. maxim-zaks

    maxim-zaks

    Joined:
    Jul 24, 2019
    Posts:
    9
    Hi folks,

    I created a small Editor window, which lists all data components and their size. It also tells you if you property layout introduce unnecessary padding and can be improved. It does not tell you how to improve it yet though. I am thinking about adding hints.

    You can find it on Github:
    https://gist.github.com/mzaks/ec261ac853621af8503b73391ebd18f1

    Here is also a blog post which explains in more detail what kind of problem it solves:
    https://medium.com/@icex33/memory-alignment-and-component-design-in-unity-ecs-84f05f21ccc8

    Words of caution: the tool might generate false negatives, so if you see something please let me know in this thread and I can see if it is possible to fix the tool.

    Here is a sample screen shot, where you can see that LightComponent in Unity.Rendering.Hybrid package could be 4 bytes smaller ;).

     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,684
    Huh you finally done it :)
    You can remember me as this guy :)
    upload_2019-9-27_21-25-8.png
     
    maxim-zaks likes this.
  3. maxim-zaks

    maxim-zaks

    Joined:
    Jul 24, 2019
    Posts:
    9
    Yeah, I don't know what took me so long to release it on Github :)