This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Improve channels (across go routines) performance for certain scenarios #11506
Labels
Feature/Enhancement Request
This issue is made to request a feature or an enhancement to an existing one.
Currently channels (
vlib/sync/channels.v
) use a ring buffer with smart locking optimizations (I didn't yet find any time to check correctness of these considering the C memory model as described in https://research.swtch.com/mm - there might be some fences needed or not... IDK - but so far it seems to do what's expected in usual setups). Thanks @UweKrueger for all the hard work!The performance is acceptable and the ring buffer itself doesn't seem to be the main bottle neck for usual scenarios using (very) small buffer capacities. For others (incl. networking, "message passing", actor frameworks, etc.) this will become a limitation though.
One potential solution could be the use of a "BipBuffer" (aka "virtual ring buffer") as described in https://www.codeproject.com/Articles/3479/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist and http://vrb.sourceforge.net/ and https://ferrous-systems.com/blog/lock-free-ring-buffer/ and https://github.com/jamesmunns/bbqueue and others. Except for the main property of being contiguous, another advantage is, that BipBuffer should allow for even more locking optimizations.
Those of you needing some more performance from channels, feel free to give it a try!
@UweKrueger @medvednikov @spytheman @cristian-ilies-vasile @JalonSolov @penguindark and many others...
The text was updated successfully, but these errors were encountered: