Sha256: 864710fe0b2fea2af814e83ef6c609a1da352a9974e6b4c860eb6fdaed9a9ccb

Contents?: true

Size: 839 Bytes

Versions: 4

Compression:

Stored size: 839 Bytes

Contents

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

require 'benchmark'

iterations = 10
urls = File.readlines(File.dirname(__FILE__) + '/feed_list.txt')
files = Dir.glob(File.dirname(__FILE__) + '/feed_xml/*.xml')
xmls = files.map { |file| File.open(file).read }
feeds = Feedzirra::Feed.fetch_and_parse(urls).values

Benchmark.bm(15) do |b|
  b.report('parse') do
    iterations.times do
      xmls.each { |xml| Feedzirra::Feed.parse xml }
    end
  end

  b.report('fetch_and_parse') do
    iterations.times { Feedzirra::Feed.fetch_and_parse urls }
  end

  # curb caches the DNS lookups for 60 seconds, so to make things fair we have
  # to wait for the cache to expire
  65.times { sleep 1 }

  b.report('update') do
    iterations.times do
      feeds.each { |feed| Feedzirra::Feed.update feed }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
feedzirra-0.7.1 benchmarks/basic.rb
feedzirra-0.7.0 benchmarks/basic.rb
feedzirra-0.6.0 benchmarks/basic.rb
feedzirra-0.5.0 benchmarks/basic.rb