Skip to content

Instantly share code, notes, and snippets.

@mykoweb
Created December 20, 2016 00:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mykoweb/abebce476d27002b1b1156a1f8d5724c to your computer and use it in GitHub Desktop.
Save mykoweb/abebce476d27002b1b1156a1f8d5724c to your computer and use it in GitHub Desktop.
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