Search Unity

Newbie question: Is ECS all about designing the layout/packing of machine code in cache?

Discussion in 'Entity Component System and C# Job system' started by ghtx1138, Jan 9, 2019.

  1. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    111
    Hi there

    I have just started learning ECS and it seems like it is making sense to me.

    Is ECS a sort of intermediate framework for ensuring that the machine code is neatly packed into cache?

    If yes, could you please explain how an 8k or 16k cache is "big" enough to hold a game. I realise this is sort of like asking how long is a bit of string.

    Thanks
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    3,843
    Hi and welcome.

    We got just brand new article to read for you, to get better familiar with a topic.
    https://forum.unity.com/threads/ecs-deep-dive-blog-post.610138/

    Is more about packing nicely data in memory and cache, to access it rapidly, than machine code itself.

    You are referring likely to chunks. Article discuss them briefly. Chunks are 16k in size and is not one but many of them. Hence you can store lots of data, as your game need. Is however faster to move and access data in chunks for cache.
     
  3. ghtx1138

    ghtx1138

    Joined:
    Dec 11, 2017
    Posts:
    111
    Hey @Antypodish thanks very much for that link. I am slowly digesting it and I think I have a basic idea what is going on. I have a background in OOP process modelling and I can see now that this is a much lower level design paradigm especially for high performance computing.

    Cheers
     
    Antypodish likes this.
  4. tarahugger

    tarahugger

    Joined:
    Jul 18, 2014
    Posts:
    71
    I've been figuring this out recently too and the main point really is getting increased performance, which comes from a few key aspects
    • Not using Unity as you knew it. Everything is ECS is rebuilt from the ground up with performance in mind. The data-oriented design part is being focussed on a lot but it would seem to me a large part of the difference can be attributed instead to basically re-writing the core systems (like how transforms and game objects are handled).
    • Ability for code to properly run on multiple threads (Unity is normally single threaded).
    • The burst compiler can convert C# code directly to optimized Assembly, which is as good as it gets, versus running as IL.