Sha256: 241d401409f1b218a4addbb8f57d26f63e4078245c7a67e86f5eb8f4675c0a70

Contents?: true

Size: 1.65 KB

Versions: 9

Compression:

Stored size: 1.65 KB

Contents

$LOAD_PATH.unshift "./lib"
require 'vcr'
require 'yaml'
require 'open-uri'
require 'benchmark'

VCR.configure do |vcr|
  vcr.cassette_library_dir = './tmp'
  vcr.hook_into :webmock
end

def prepare_cassette
  interactions = 1.upto(100).map do |i|
    VCR::HTTPInteraction.new(
      VCR::Request.new(:get, "http://foo.com/#{i}", "", {}),
      VCR::Response.new(
        VCR::ResponseStatus.new(200, "OK"),
        {}, "Response #{i}", "1.1"
      ),
      Time.now
    ).to_hash
  end

  hash = { "http_interactions" => interactions, "recorded_with" => "VCR #{VCR.version}" }
  VCR.cassette_persisters[:file_system]["logging.yml"] = YAML.dump(hash)
end

prepare_cassette

puts "Ruby #{RUBY_DESCRIPTION}"

3.times do
  puts Benchmark.measure {
    100.downto(50) do |i|
      VCR.use_cassette("logging", :record => :none) do
        open("http://foo.com/#{i}")
      end
    end
  }
end

# Before optimizing null logging:
#
# Ruby ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
#   1.510000   0.010000   1.520000 (  1.523553)
#   1.500000   0.010000   1.510000 (  1.510036)
#   1.500000   0.010000   1.510000 (  1.507076)
#
# After applying the patch from #311 (and forcing `debug_logger` to `nil`:
#
# Ruby ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
#   1.480000   0.020000   1.500000 (  1.500136)
#   1.390000   0.000000   1.390000 (  1.395503)
#   1.400000   0.010000   1.410000 (  1.403931)
#
# After applying my alternate fix:
#
# Ruby ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
#   1.400000   0.010000   1.410000 (  1.410103)
#   1.380000   0.010000   1.390000 (  1.388467)
#   1.360000   0.010000   1.370000 (  1.364418)

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/vcr-2.9.3/benchmarks/null_logging.rb
vcr-2.9.3 benchmarks/null_logging.rb
vcr-2.9.2 benchmarks/null_logging.rb
vcr-2.9.1 benchmarks/null_logging.rb
vcr-2.9.0 benchmarks/null_logging.rb
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/vcr-2.8.0/benchmarks/null_logging.rb
vcr-2.8.0 benchmarks/null_logging.rb
vcr-2.7.0 benchmarks/null_logging.rb
vcr-2.6.0 benchmarks/null_logging.rb