Created
December 20, 2016 00:38
-
-
Save mykoweb/abebce476d27002b1b1156a1f8d5724c 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
require 'faraday' | |
require 'benchmark' | |
@conn = Faraday.new(url: 'https://www.google.com') | |
@threads = [] | |
Benchmark.bm(14) do |x| | |
x.report('no-threads') do | |
8.times { @conn.get } | |
end | |
x.report('with-threads') do | |
8.times do | |
@threads << Thread.new { @conn.get } | |
end | |
@threads.each(&:join) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment