Search Unity

Question Increate 128 entities limit at least to 256?

Discussion in 'DOTS Dev Blitz Day 2022 - Q&A' started by JesOb, Dec 8, 2022.

  1. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109
    Hi

    Entities 1.0 introduces entities limit per chunk 128
    As I understand it is for optimal simd 128 vector operation on it but limits abilities of entities some examples on forum show more than 2x performance drop on optimized archetypes

    Do Unity considered to increase this limit at least to 256? It must cost only one additional if (capacity > 128) per chunk for chunks with less then 128 entities and benefit more optimized ones.
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,264
    Just my 2 cents. I don't think this is actually necessary. I'm not saying that nothing needs to be done, but rather that there is a better alternative.

    If Unity were to detect "hot" archetypes and use mega chunks, where chunks inside mega chunks were described by a range of indices, then the chunks inside would no longer need to conform to the 16 kB size requirements. That would solve memory usage as well as the early prefetcher termination issue without requiring any change to the public API.
     
    mbaker likes this.
  3. arnaud-carre

    arnaud-carre

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    97
    Right now ECS chunks are both 16KiB and 128 entities max. 128 entities in a 16KiB chunk means 128byte per entity. In practice most of the time, entitie are even bigger than 128 bytes, so increasing limit to 256 entities per chunk won't probably change anything.

    We do noticed some slowdown with extreme case with just 16 bytes entity when browsing chunks linearly. We have some fix in flight involving CPU memory fetch instruction. But this is really special case and shouldn't affect most users.

    Do you have any link to share regarding 2x performance on optimized archetype?
     
    Last edited: Dec 8, 2022
  4. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Any plan to increase chunk size very soon at dots 1.0 pre-release or after leaving pre-release? Currently it's really pain point for my dots netcode project that I forced to move components to another entity as child entity because of this 16KiB ECS chunk limit. And also try to sync component data at child entity across network will have performance penalty.
     
  5. JesOb

    JesOb

    Joined:
    Sep 3, 2012
    Posts:
    1,109