-
Notifications
You must be signed in to change notification settings - Fork 5
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
Non-blocking IO #1
Comments
At the moment this uses the standard library By the way, this library hasn't been updated in a while. I still intend to keep working on it but I'm a bit distracted by other projects at the moment. |
Any opinions on debuging? It's an absolute bitch debugging code that runs close to GNUnet's scheduler, although I think that'd be easier with futures, promises, etc. and Rust's closures help address the unreadability. I think @tailhook claimed that state machines should be easier though. I suppose that's believable, certainty they should be easier to write unit tests for, even when compared to coroutines. |
Yeah, debugging is another reason why I don't like callback-heavy code. Blocking-based (or pseudo-blocking-based a.la. mioco) code is much easier to follow the execution of. I think rotor-style state machines would be great for preventing bugs in the first place. The way that methods consume self and only return it if the object is still in a good state means you get a static guarantee that your code can never find its way into an invalid state. If I had my dream language to re-write the world in it would be pure-functional (ie. no |
IMO, a large number of |
@carllerche what about performance? It looks like @seanmonstar have tried eventual and got more than 10x drop in performance (hyperium/hyper#395 (comment)). My opinion is that FRP may be used on a much higher level, like managing protocol units rather than TCP chunks and epoll events. But lower level should be implemented as FSM. |
I have not looked in detail into how @seanmonstar used it. 10x seems excessively high to me in real world usage. Also once specialization lands, I will be able to make some significant performance improvements to Eventual. There is no doubt that a pure state machine strategy is the fastest, but will take more boiler plate. I personally believe FRP w/ something like Eventual is the most ergonomic way to structure async / concurrent code. It's all a question of tradeoffs. |
Appears capnp-rpc-rust issue 5 discussion clarifies the |
At present this uses blocking IO? Or would you classify it as currently generic over the IO system in the sense that it is not really doing that yet?
Afaik almost everyone doing asynchronous IO in rust is using https://github.com/carllerche/mio in one form of fashion. It's a bare metal wrapper over epoll and kqueue that makes them work alike by calling a single common handler. It'll support Windows eventually too, albeit with some performance penalty.
There are a bunch of libraries that make mio nicer to use, mostly they build coroutines, like https://github.com/dpc/mioco, but several use callbacks like GNUnet's scheduler :
Also https://github.com/tailhook/rotor wants to do asynchronous IO using state machines built with algebraic data types, and composable so you can have them at multiple levels. Ain't exactly like GNUnet's scheduler, but sounds interesting.
I mostly buy @tailhook arguments for state machines over green threads and coroutnes, but his arguments for state machines over futures, promises, etc. consist of a vague claim of closures requiring too many RefCells and Rcs, which may or may not be true.
The text was updated successfully, but these errors were encountered: