genaray/ZeroAllocJobScheduler

Pool the `CombineDependencies` list

LilithSilver opened this issue · 0 comments

Currently, users are forced to maintain a List<JobHandle> for each CombineDependencies call they make. And they can't even reuse this list between CombineDependencies calls -- only when they're sure the job has resolved. This isn't great from an API standpoint.

With #11, we have a value n we can look at to determine the maximum current simultaneous job count without allocation, and therefore n - 1 is the theoretical maximum amount of dependencies that can be used with CombineDependencies in one go. If we pre-allocate n lists of n - 1 length, we can easily clear and reuse a list if the list is returned, or alternatively begin allocating new lists if none are available (or adding to existing lists if they aren't big enough).

Users would still have to maintain a List<JobHandle> but it wouldn't be tied to the internal state anymore. So it's a much more reasonable ask.

As discussed in #7.