-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Rewrite channel in Crystal #3920
Comments
As someone unfamiliar with comparing Crystal's efficiency to that of other languages', I have some stupid questions:
I ask because I'm genuinely interested in concurrency, threading, and digging into this topic at a lower level than I have thus far. Crystal seems like as good of a medium to do so as any other. Also, it might give good background knowledge for your change on the associated pull request to those who might not have previous knowledge of the topic. |
@TheLonelyGhost I am not familiar with Go, so I don't know how Go implement it. Maybe there are some optimization in Go such that have smaller memory usage in channel. The current channel in Crystal is implemented by two queues (one for sender fibers and another one for receiver fibers) and the share buffer for communicating. Denote that this is impossible to make receiver queue and share buffer be both non-empty. One of The another change is the |
Closing, but only because in the |
refer to #3912
I want to rewrite channel since current channel is hard to be thread safe and there are some bugs in
select operation, see #3900 #3862. The new design is implemented by some simple I-Var. It can be
thread safe if the coroutine switch is thread safe. Also those bugs in select will be solved since that
will not queue the duplicate fiber into scheduler.
And this is the performance tested by threadring
https://gist.github.com/firejox/f9fb7c4b6d44501d0b1070c123a1fab6
The text was updated successfully, but these errors were encountered: