Sha256: 5ce8b80a60035160cd741d5dd66d887a7d25661c17e3dd57fb98989299f3e675
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
require File.dirname(__FILE__) + '/../../lib/feedzirra.rb' require 'rfeedparser' require 'feed-normalizer' 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") do iterations.times do Feedzirra::Feed.fetch_and_parse(urls, :on_success => lambda { |url, feed| $stdout.print '.'; $stdout.flush }) end end t.report("rfeedparser") do iterations.times do urls.each do |url| feed = FeedParser.parse(url) $stdout.print '.' $stdout.flush end end end t.report("feed-normalizer") do iterations.times do urls.each do |url| # have to use the :force option to make feed-normalizer parse an atom feed feed = FeedNormalizer::FeedNormalizer.parse(open(url), :force_parser => FeedNormalizer::SimpleRssParser) $stdout.print '.' $stdout.flush end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
feedzirra-0.4.0 | spec/benchmarks/feedzirra_benchmarks.rb |
feedzirra-0.3.0 | spec/benchmarks/feedzirra_benchmarks.rb |
feedzirra-0.2.2 | spec/benchmarks/feedzirra_benchmarks.rb |