decline-cookies / anvil-unity-dots

Unity DOTS and ECS specific additions and extensions to Anvil
MIT License
4 stars 1 forks source link

Massively optimizing TaskDriver performance #264

Closed jkeon closed 1 year ago

jkeon commented 1 year ago

Optimized TaskDrivers so they won't schedule jobs if no one has written to them.

What is the current behaviour?

TaskDrivers always run their jobs even if there is no data to operate on. This leads to a lot of scheduling overhead that adds up.

What is the new behaviour?

TaskDriverManagementSystem forces a sync after consolidation. This is to prevent issues with circular writing patterns such as:

By forcing the consolidation, we can also check the length to ensure we actually have data when scheduling.

AbstractData exposes a boolean to let callers know if its data could have been invalidated. If so, it's worth scheduling the job. Otherwise, no one has touched it.

AbstractJobConfig will only schedule jobs if the scheduling data has data to work on. AbstractDataSource will only consolidate data if there has data to work on.

What issues does this resolve?

What PRs does this depend on?

Does this introduce a breaking change?

jkeon commented 1 year ago

@mbaker3 Ready for re-review