Sha256: d8df078964125458b05ad0f1258d4a6ceef19a9bdcc4f2689b4a5a73f6a14e0c

Contents?: true

Size: 835 Bytes

Versions: 3

Compression:

Stored size: 835 Bytes

Contents

require 'rubygems'
require File.dirname(__FILE__) + '/../../lib/feedzirra.rb'

require 'open-uri'

require 'benchmark'
include Benchmark

iterations = 10
urls = File.readlines(File.dirname(__FILE__) + "/../sample_feeds/successful_feed_urls.txt").slice(0, 20)
puts "benchmarks on #{urls.size} feeds"
puts "************************************"
benchmark do |t|
  t.report("feedzirra open uri") do
    iterations.times do
      urls.each do |url|
        Feedzirra::Feed.parse(open(url, "User-Agent" => "feedzirra http://github.com/pauldix/feedzirra/tree/master").read)
        $stdout.print '.'; $stdout.flush
      end
    end
  end

  t.report("feedzirra fetch and parse") do
    iterations.times do
      Feedzirra::Feed.fetch_and_parse(urls, :on_success => lambda { |url, feed| $stdout.print '.'; $stdout.flush })
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
feedzirra-0.4.0 spec/benchmarks/fetching_benchmarks.rb
feedzirra-0.3.0 spec/benchmarks/fetching_benchmarks.rb
feedzirra-0.2.2 spec/benchmarks/fetching_benchmarks.rb