Closed talex5 closed 7 months ago
I'd really like to see if we can get @patricoferris' GCD backend integrated for a 1.0 as well.
What’s Lwt_async?
I'd really like to see if we can get @patricoferris' GCD backend integrated for a 1.0 as well.
I have a much better understanding of Eio and concurrency/async IO now, so I'll see if I can bring this backend into shape and see how it's performance is.
What’s Lwt_async?
Possibly a typo :)) and was supposed to be async_eio
https://github.com/talex5/async_eio ?
Possibly a typo :)) and was supposed to be async_eio https://github.com/talex5/async_eio ?
Yes! Fixed :-)
js_of_ocaml is is merged now. What would js_of_ocaml support look like?
I think there are two backends that would be needed for good jsoo support, one for node and one for the browser. For a quick win in the browser, I think just taking the mock backend's scheduler might be a good place to start and adding whatever things from the standard environment make sense e.g. jsoo has a notion of a fake filesystem which could be the backend for the fs
parts of jsoo but jsoo would probably never have a network capability (or not now https://github.com/WICG/direct-sockets)
For node, we just need to wrap the node bindings which are basically libuv. I made a start over here: https://github.com/patricoferris/eio/tree/node/lib_eio_js
For a quick win in the browser, I think just taking the mock backend's scheduler might be a good place to start and adding whatever things from the standard environment make sense
Yep (actually, this is a good place to start for any backend). Eio_main.run
is intended for Unix-type systems and it's completely OK for JS applications to use a separate Eio_js.run
with a different set of resources.
For node, we just need to wrap the node bindings which are basically libuv. I made a start over here: https://github.com/patricoferris/eio/tree/node/lib_eio_js
Excellent!
BTW, you might want to rebase your node backend on Eio 0.7, as there have been quite a few changes to the error handling since the commit it's based on.
Is it practical to hand-roll node bindings using jsoo ffi directly nowadays? ts2ocaml can generate bindings out of TypeScript definitions. Bindings will use gen_js_api to actually compile to something that will work on jsoo. For simple libraries ts2ocaml can produce compileable bindings that you can use straight away. For more complex ones like Node API it can save you 80% of work.
How fast can jsoo be with effects? So far the consensus is that it's slow and as an optimization they suggest to avoids CPS transformaton for code that does not use effects. Will Eio code (that is 100% on effects) run fast enough on jsoo to be practical to be used anywhere in production?
Is it practical to hand-roll node bindings using jsoo ffi directly nowadays?
It's a fair point, but yes I think it is still practical as there's not that many. I am also firmly in the camp of hand-rolling a bit even if you eventually automate (like hand-writing C stubs before reaching for ctypes) so you are in full control over the bindings to avoid hard to debug problems (e.g. for effects to work the calling convention must use the underlying caml_js_wrap_callback_strict
otherwise it won't be registered and I knew Brr made this update fairly quickly, I don't know if gen_js_api
and ts2ocaml
have ensured this (maybe they already did?)).
How fast can jsoo be with effects?
See the latest PR https://github.com/ocsigen/js_of_ocaml/pull/1384.
As an update for this thread, there's a PR open for the browser backend. https://github.com/ocaml-multicore/eio/pull/405
Status of major features needed for Eio 1.0 (a tick means would be OK to ship in its current state):
Backends:
Non-essential backends (but would be good to check that the cross-platform API works for them before 1.0 if possible):
Features:
Integrations:
Testing:
tests
directory).bench
directory).stress
directory; currently semaphore only).fuzz
directory).