ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
559 stars 72 forks source link

eio_linux: refactor fixed buffer code #752

Closed talex5 closed 2 months ago

talex5 commented 2 months ago

Instead of having separate Alloc, Alloc_or_wait and Free effects, the scheduler now provides a single Get effect to return itself, and the actual work is now done in the calling fiber. This is a first step to align better with Picos's trigger mechanism (it actually uses Single_waiter, Eio's non-thread-safe equivalent, which is fine here). It seems to be slightly faster too, though that could just be noise.

It would be possible to use DLS to store the scheduler rather than using an effect. However, the improvement in speed is minimal and there are some complications with sys-threads, so probably better to wait for OCaml to support thread-local-storage first.

Note that the wait is non-cancellable at the moment (it was like that before too).