Sha256: 27817c743eb8f522f6e1f4fdc9cbb5c5cd6802c142424a8d56f833b34b958a7b

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

# encoding: UTF-8
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
$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.bmbm do |x|
  x.report do
    puts "Streamly"
    (ARGV[1] || 1).to_i.times do
      Streamly.get(url)
    end
  end

  x.report do
    puts "Shell out to curl"
    (ARGV[1] || 1).to_i.times do
      `curl -s --compressed #{url}`
    end
  end

  x.report do
    puts "rest-client"
    (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
streamly_ffi-0.1.5 benchmark/basic_request.rb
streamly-0.1.4 benchmark/basic_request.rb