Skip to content

Instantly share code, notes, and snippets.

@jpemberthy
Last active December 15, 2015 11:59
Show Gist options
  • Save jpemberthy/5257088 to your computer and use it in GitHub Desktop.
Save jpemberthy/5257088 to your computer and use it in GitHub Desktop.
class Foo
def threaded_upload
t1 = Time.now
threads = []
100.times do |i|
threads << Thread.new(i) do |i|
uploader = Attachment::Uploader.new
uploader.upload("0" * 20 * 1024, "threaded/#{i}")
end
end
threads.each(&:join)
puts "Total Time: #{Time.now - t1} seconds"
end
def upload
t1 = Time.now
uploader = Attachment::Uploader.new
100.times do |i|
uploader.upload("0" * 20 * 1024, "regular/#{i}")
end
puts "Total Time: #{Time.now - t1} seconds"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment