Search Unity

why can the subscene of the ECS improve load times ?

Discussion in 'Entity Component System' started by chuyuwei, May 30, 2019.

  1. chuyuwei

    chuyuwei

    Joined:
    May 29, 2019
    Posts:
    19
    I don't understand why the usage of subscene can improve load times.
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,685
    Cos they loading asynch in different world.
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Mainly it improves load times because the data format for an entity scene is memory ready and does not go through serialization. So there is practically no CPU work to load something. Also we support loading on more than one thread. Also ECS data is generally far more compact. Also gameobjects generally do many internal mallocs that are expensive. Also object reference remapping is expensive in the serialization layer for game objects. But the real killer reason for streaming is that the activation cost on the main thread for having a ton of objects show up in the same frame and have systems pick them up is a lot faster due to it not being done with random memory access virtual call into C++ calling virtual function in C# etc... It's all beautiful linear memory access blasting through the data, the overhead is essentially near non-existing for streaming. It's just down to how well the specific systems deal with many objects arriving. And there are many techniques to make that be zero too...

    So many reasons...
     
  4. chuyuwei

    chuyuwei

    Joined:
    May 29, 2019
    Posts:
    19

    Thank you a lot,why is entity scene memory ready. And is it different between the gameobjects in entity scene and gameobjects in traditional scene.
     
  5. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Because being memory ready data format makes it insanely fast to load, because doing no work at runtime is always the best optimization. And making everything as fast as possible including loading is what we do with DOTS.

    The foundation for game objects has been built 14 years, when OO was hip, and I didn't really have a clear overview of what the cost of that ultimately was. We also didn't prioritize performance to the same extent 14 years ago as we do now.

    Making the existing game object architecture have the properties we now want it to have turned out to be near impossible.

    Hence we are building DOTS. Giving Unity developers a choice when they want to write the absolute fastest code.
     
  6. batman2211

    batman2211

    Joined:
    Sep 16, 2017
    Posts:
    10
    Sorry I know its an old thread but can I use subscene loading for a scene which contains gameobjects not entities? or I have to convert all my gameobject to entities to use it? Thanks