Skip to content

Commit

Permalink
clean up bench
Browse files Browse the repository at this point in the history
  • Loading branch information
taf2 committed Nov 5, 2011
1 parent 1c8ec56 commit c6a763d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bench/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source :rubygems

gem 'curb', '0.3.2'
gem 'curb', '0.1.4'
gem 'rmem'
gem 'net-http-persistent'
gem 'em-http-request'
Expand Down
4 changes: 2 additions & 2 deletions bench/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GEM
remote: http://rubygems.org/
specs:
addressable (2.2.4)
curb (0.3.2)
curb (0.1.4)
em-http-request (0.3.0)
addressable (>= 2.0.0)
escape_utils
Expand All @@ -22,7 +22,7 @@ PLATFORMS
ruby

DEPENDENCIES
curb (= 0.3.2)
curb (= 0.1.4)
em-http-request
net-http-persistent
patron
Expand Down
2 changes: 1 addition & 1 deletion bench/Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
task :default do
sh "bundle install"
n = 8000
n = 20000
results = {}
system("cd ../ && rake compile")
[:curb_easy14, :curb_easy, :curb_multi, :curb_multi_using_get, :emhttprequest, :nethttp_test, :patron_test, :typhoeus_hydra_test, :typhoeus_test].each do|bench|
Expand Down
19 changes: 14 additions & 5 deletions bench/curb_multi_using_get.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@

N = (ARGV.shift || 50).to_i
BURL = 'http://127.0.0.1/zeros-2k'
URLS = []
N.times do|n|
URLS << BURL + "?n=#{n}"
end

Memory.usage("Curl::Multi.get(#{N})") do
require 'curb'

Curl::Multi.get(URLS)
group = []
N.times do|n|
url = BURL + "?n=#{n}"

group << url

if group.size == 10
Curl::Multi.get(group)
group = []
end

end

Curl::Multi.get(group) if group.any?

end

0 comments on commit c6a763d

Please sign in to comment.