-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
single-producer and/or single-consumer variants #11
Comments
I've started on a new variant in which reads don't block (related to #3). This will also support a much faster path for single consumers (SC), as well as pre-interleaved consumers, via a Here is a bit of the API I have so far. First we have a function similar to
And here is what our stream type looks like (at the moment). Reading from a stream requires absolutely no coordination with other readers or writers:
|
Per this post Gabriel pointed out that my stream type is essentially |
I have a single consumer case and a separate single producer case. Basically I'm doing fan-in reading and fan-out writing from a process. The readers and writers are all doing IO so they would all be a separate thread but in both cases, the singleton will be a single thread. Would Also, I'm adding new writers on new network connections so building them all ahead of time in a list would not be ideal. Dup works better except dup requires a special case to use the original chan and then dup from there on out. |
Actually I won't be including streaming library -agnostic streaming in the next release; waiting on Gabriella439/pipes#131 |
It would be straight-forward to write variants of the
readChan
andwriteChan
functions which can omit some atomic operations or bookkeeping when only run from a single thread. At some point I certainly plan to do this forreadChan
to support an even more efficient MPSC queue.A cop-out which may happen would be to simply export
Or alternatively, a safe API which uses lazy IO:
I'm not sure if the later is easily-done, or would have performance implications.
Please comment if you have an interest in this use case or any thoughts.
The text was updated successfully, but these errors were encountered: