#ComponentLookup + Entity ref vs ISharedComponentData

1 messages · Page 1 of 1 (latest)

indigo forge
#

Hey. I have a lot of entities which require the same large piece of data (FooData), I was originally going to store the data on a separate entity, pass both that Entity and ComponentLookup<FooData> into parallel jobs for my large group of entities. But I was wondering if using a ISharedComponentData would be more performant? I don't have a good sense of how cheap component lookups are. The ISharedComponentData saves plumbing and juggling Entity 'references'.

Any thoughts?

Thanks for the help!

prime eagle
#

Is this data immutable?

#

It sounds like a good candidate for blobs

indigo forge
#

Ya the data is immutable. Would there be benefits to using blobs rather than just having the data defined directly on the ISharedComponentData? The data isn't large enough to take up much of the chunk, but more than I want to replicate across Entities.

prime eagle
#

well shared components have other consequences

#

is this data loaded from baking?

#

because how do you intend to store it on the shared component

#

i assume you want your shared component to be unmanaged so you can access it in jobs

#

how many variations of this shared component do you have?

indigo forge
#

Probably only 10-20 variants. Each on > 10000 entities.

prime eagle
#

so you have 100-200k entities?

#

well, at least the shared component won't impact your chunk utilization

indigo forge
#

10k-100k is probably a decent range estimate.

prime eagle
#

Well, I can't really think of a major red flag against using the ISCD here as long as

  • you can author it and it's unmanaged
  • your entity count is high
  • your variations are low
  • it's immutable and you don't have to do add/remove shared components at runtime
  • you aren't hitting the ISCD cap
indigo forge
#

Thanks for the confirmation!

#

Do you have a sense of how costly or ill advised (or not) using ComponentLookups and Entity refs are to get single chunks of data into many entities across parallel jobs?

prime eagle
#

it's pretty fast but it depends on how frequent you do it

#

it's going to be a faster to just have a single copy of the shared component and not have to look it up per entity if you have any decent count

#

but really, you just need to benchmark your usecase for yourself