ocaml-multicore / picos

Interoperable effects based concurrency
https://ocaml-multicore.github.io/picos/doc/picos/index.html
ISC License
86 stars 3 forks source link

Add multi-producer multi-consumer queue allowing pushes to both ends #218

Closed polytypic closed 2 months ago

polytypic commented 2 months ago

This adds a MPMC queue with the ability to push to both ends of the queue, which makes it possible to prioritize cancelation.

This should already give pretty good performance when mostly used from one domain.

The push_head operation can be optimized further (I did a quick attempt and got up to 15% improvement in a high contention benchmark) and there are probably some more tweaks that could improve performance a bit, but I'm leaving that to future work.