Sha256: 256b8451102eb159c8a9b5f16204899c16ad322eb755bc3584a9feeb4d0f20bc

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

# encoding: UTF-8
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'rubygems'
require 'net/http'
require 'rest_client'
require 'streamly'
require 'benchmark'

url = ARGV[0]

Benchmark.bm do |x|
  puts "Streamly"
  x.report do
    (ARGV[1] || 1).to_i.times do
      Streamly.get(url)
    end
  end
  
  puts "Shell out to curl"
  x.report do
    (ARGV[1] || 1).to_i.times do
      `curl -s --compressed #{url}`
    end
  end
  
  puts "rest-client"
  x.report do
    (ARGV[1] || 1).to_i.times do
      RestClient.get(url, {"Accept-Encoding" => "identity, deflate, gzip"})
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
brianmario-streamly-0.1.3 benchmark/basic_request.rb
streamly-0.1.3 benchmark/basic_request.rb