Open aaronalbers opened 5 years ago
I think we'd like to hear more detail about possible use cases for this feature in order to evaluate it for the library.
[IIUC (?), this implementation is using .then
to chain together units of serial work, which is extremely inefficient. ]
I created a batcher using what I call a serial series. A serial series is like a serial queue but can be canceled. You can think of a serial queue as the Y axis, fully parallel as the X axis and batching everything in between.
You would use a batch when you know ahead of time how many units of work you have but don't want to completely occupy your executor with it. Or perhaps the work that needs to be done can be parallelized but is constrained on how many can be done at once.
Perhaps something like this would also be useful in the library.
Note: Of course having a batch size larger than the pool size of your executor is somewhat meaningless.