forked from taf2/curb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
28 lines (27 loc) · 871 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
task :default do
sh "bundle install"
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|
result = `ruby #{bench}.rb #{n}`
results[bench] = result.scan(/Duration: (\d*\.\d*) sec, Memory Usage: (\d*\.\d*) KB - Memory Growth: (\d*\.\d*) KB/).flatten.map {|v| v.to_f}
results.delete(bench) if results[bench].empty?
puts result
end
# find shortest time
best_time = nil
best_key_time = nil
results.each do|k,v|
if best_time.nil? || best_time.first > v.first
best_key_time = k
best_time = v
end
end
puts "Fastest: #{best_key_time} in #{best_time.inspect}"
# find smallest memory
best_mem = nil
best_key_mem = nil
results.each do|k,v|
end
end