-
-
Save RX14/31840240d9a3b751b5f327b16eaee652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
channel = Channel(Int32).new | |
spawn do | |
start = Time.now | |
100_000_000.times do | |
channel.send 1 | |
channel.receive | |
end | |
p 100_000_000 / (Time.now - start).total_seconds | |
end | |
spawn do | |
start = Time.now | |
100_000_000.times do | |
channel.receive | |
channel.send 1 | |
end | |
p 100_000_000 / (Time.now - start).total_seconds | |
end | |
Fiber.yield |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment