Created
April 14, 2023 03:19
-
-
Save patmaddox/a0742523bb15f8f1ded83c0e01136f64 to your computer and use it in GitHub Desktop.
elixir peg all CPUs (or not?)
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
IO.puts("Schedulers: #{System.schedulers_online()}") | |
Stream.repeatedly(fn -> 1 end) | |
|> Stream.with_index(1) | |
|> Task.async_stream(fn {val, index} -> | |
# if index % 1000 == 0 do | |
Process.sleep(:rand.uniform(10)) | |
IO.puts(index) | |
# end | |
end, max_concurrency: 20) | |
|> Stream.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment