Search Unity

Should BlobAssetReference be used to store all immutable data?

Discussion in 'Entity Component System' started by Abbrew, Apr 17, 2021.

  1. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Are there any performance advantages for using BlobAssetReference to store all data that's immutable, or should they only be used to store immutable, unique data (like via AddUniqueBlobAsset)? How does the size of the data affect if BAR should be used?
     
  2. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    BlobAssets reduce the number of copies of the blob data in memory, replacing the copies with 8 byte pointers. But the blob assets are no longer laid out linearly in memory, so if every entity has a unique instance, you are just adding cache misses.
     
    Egad_McDad and Abbrew like this.
  3. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Thanks, so only use BAR for their memory-reducing capabilities
     
  4. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    There are other use cases, one is de-serialization.
     
    Egad_McDad likes this.