-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract the ring-ish structure implicit in Fanout
One of the oddities of `Fanout` was the use of an `i` to index sinks. This was, partially, preserved across polls but was not in general use when looping. It is my understanding that `Fanout.i` was ultimately vestigial and any actual indexing was reset each poll. I think, as a result, we would also repoll the same sink multiple times when removals happened, which should be rare in practice but was possible. I have extracted the vector and index munging into a `Store` type. We should now no longer poll underlying sinks multiple times and calling code does not have to munge indexes, although it is required to manually advance/reset a 'cursor' because we're changing the shape of an iterator while iterating it. The primary difference here is the use of `swap_remove` instead of `remove`. This saves a shift. I expect no performance change here. I think, ultimately, this is a stepping stone to getting the logic here very explicit so we can start to do broadcasting in a way that is not impeded by slow receivers downstream. REF #10144 REF #10912 Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
- Loading branch information
Showing
1 changed file
with
132 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters