Skip to content

Commit

Permalink
updated the benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldix committed Feb 1, 2009
1 parent 65b63d0 commit 1fa8c45
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
13 changes: 8 additions & 5 deletions spec/benchmarks/feedzirra_benchmarks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
include Benchmark

iterations = 10
urls = File.readlines(File.dirname(__FILE__) + "/../sample_feeds/successful_feed_urls.txt")
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|
Expand All @@ -28,10 +28,13 @@
end

t.report("feed-normalizer") do
urls.each do |url|
feed = FeedNormalizer::FeedNormalizer.parse(open(url), :force_parser => FeedNormalizer::SimpleRssParser)
$stdout.print '.'
$stdout.flush
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
22 changes: 3 additions & 19 deletions spec/benchmarks/parsing_benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,20 @@
benchmark do |t|
t.report("feedzirra") do
iterations.times do
f = Feedzirra::Feed.parse(xml)
title = f.title
first_title = f.entries.first.title
first_author = f.entries.first.author
first_url = f.entries.first.url
Feedzirra::Feed.parse(xml)
end
end

t.report("rfeedparser") do
iterations.times do
f = FeedParser.parse(xml)
title = f.title
first_title = f.entries.first.title
first_author = f.entries.first.author
first_url = f.entries.first.url
FeedParser.parse(xml)
end
end

t.report("feed-normalizer") do
iterations.times do
# have to use the :force option to make feed-normalizer parse an atom feed
f = FeedNormalizer::FeedNormalizer.parse(xml, :force_parser => FeedNormalizer::SimpleRssParser)
# title = f.title
# first_title = f.entries.first.title
# first_author = f.entries.first.author
# first_url = f.entries.first.url
# puts title
# puts first_title
# puts first_author
# puts first_url
FeedNormalizer::FeedNormalizer.parse(xml, :force_parser => FeedNormalizer::SimpleRssParser)
end
end
end

0 comments on commit 1fa8c45

Please sign in to comment.