Search Unity

why can the subscene of the ECS improve load times ?

Discussion in 'Data Oriented Technology Stack' started by chuyuwei, May 30, 2019.

  1. chuyuwei

    chuyuwei

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

    eizenhorn

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

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,635
    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...
     
    k2so, mitaywalle, SugoiDev and 3 others like this.
  4. chuyuwei

    chuyuwei

    Joined:
    May 29, 2019
    Posts:
    17

    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:
    4,635
    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.
     
    xVergilx, Zoey_O and psuong like this.