Last active
March 9, 2026 08:00
-
-
Save irridescentrambler/1f9a89cc07c2fbacda8b93eec7aa4865 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| require 'net/http' | |
| require 'uri' | |
| require 'async' | |
| require 'benchmark' | |
| bm = Benchmark.measure("Asynchronous flow") do | |
| Async do | |
| results = 21.times.map do |url| | |
| Async do | |
| Net::HTTP.get_response(URI("https://dog.ceo/api/breeds/image/random"),) | |
| end | |
| end | |
| results.each do |response| | |
| puts response.wait.body | |
| end | |
| end | |
| end | |
| puts bm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment