terrbear (owner)

Revisions

gist: 132809 Download_button fork
public
Public Clone URL: git://gist.github.com/132809.git
Embed All Files: show embed
Text only #
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
CURB!
irb(main):010:0> req = Net::HTTP.new("google.com", 80)
=> #<Net::HTTP google.com:80 open=false>
irb(main):011:0> curl = Curl::Easy.perform("http://www.google.com")
=> #<Curl::Easy:0x876ba58>
irb(main):012:0> Benchmark.bm do |x|
irb(main):013:1* x.report("net/http"){20.times{req.start{|http| http.get("/")}}}
irb(main):014:1> x.report("curb"){20.times{curl.perform}}
irb(main):015:1> end
      user system total real
net/http 0.010000 0.000000 0.010000 ( 28.866806)
curb 0.000000 0.010000 0.010000 ( 1.625923)
=> true
 
 
-----
 
the test:
req = Net::HTTP.new("google.com", 80)
Benchmark.bm do |x|
x.report {100.times{req.start{|http| http.get("/")}}}
end
 
both benchmarks are GETting google.com 100 times
 
ded2 (portal)
>> Benchmark.bmbm do |x|
?> x.report {100.times{req.start{|http| http.get("/")}}}
>> end
Rehearsal ------------------------------------
   0.130000 0.010000 0.140000 ( 10.912258)
--------------------------- total: 0.140000sec
 
       user system total real
   0.050000 0.010000 0.060000 ( 10.517465)
 
 
staging2
>> Benchmark.bmbm do |x|
?> x.report {100.times{req.start{|http| http.get("/")}}}
>> end
Rehearsal ------------------------------------
   0.050000 0.020000 0.070000 ( 91.207375)
--------------------------- total: 0.070000sec
 
       user system total real
   0.060000 0.020000 0.080000 ( 94.495068)