Sha256: 70394d491ac3065068dca1b8c243befeacec3972e4da6b407cdb69d2adaac70d

Contents?: true

Size: 948 Bytes

Versions: 21

Compression:

Stored size: 948 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', 'lib/excon')

require 'benchmark'
require 'net/http'
require 'open-uri'

COUNT = 100
data = "Content-Length: 100"
Benchmark.bmbm(25) do |bench|
  bench.report('excon') do
    COUNT.times do
      Excon.new('http://www.google.com').request(:method => 'GET', :path => '/')
    end
  end
  bench.report('excon (persistent)') do
    excon = Excon.new('http://www.google.com')
    COUNT.times do
      excon.request(:method => 'GET', :path => '/')
    end
  end
  bench.report('net/http') do
    COUNT.times do
      # Net::HTTP.get('www.google.com', '/')
      Net::HTTP.start('www.google.com') {|http| http.get('/') }
    end
  end
  bench.report('net/http (persistent)') do
    Net::HTTP.start('www.google.com', 80) do |http|
      COUNT.times do
        http.get('/')
      end
    end
  end
  bench.report('open-uri') do
    COUNT.times do
      open('http://www.google.com/').read
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
bbcloud-0.8.1 lib/bbcloud/vendor/excon-0.2.4/benchmarks/excon_vs.rb
excon-0.2.4 benchmarks/excon_vs.rb
excon-0.2.3 benchmarks/excon_vs.rb
excon-0.2.2 benchmarks/excon_vs.rb
excon-0.2.1 benchmarks/excon_vs.rb
excon-0.2.0 benchmarks/excon_vs.rb
excon-0.1.4 benchmarks/excon_vs.rb
excon-0.1.3 benchmarks/excon_vs.rb
excon-0.1.2 benchmarks/excon_vs.rb
excon-0.1.1 benchmarks/excon_vs.rb
excon-0.1.0 benchmarks/excon_vs.rb
excon-0.0.26 benchmarks/excon_vs.rb
excon-0.0.25 benchmarks/excon_vs.rb
excon-0.0.24 benchmarks/excon_vs.rb
excon-0.0.23 benchmarks/excon_vs.rb
excon-0.0.22 benchmarks/excon_vs.rb
excon-0.0.5 benchmarks/excon_vs.rb
excon-0.0.4 benchmarks/excon_vs.rb
excon-0.0.3 benchmarks/excon_vs.rb
excon-0.0.2 benchmarks/excon_vs.rb