Sha256: 2544be18054bd54477bb664d0413e500871ebedacfb3b4c30c5bdd2df77f761d
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
require 'benchmark' require 'feedjira' require 'simple-rss' require 'feed-normalizer' require 'feed_me' 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 } # suppress warnings $VERBOSE = nil puts 'Parsing benchmarks' Benchmark.bm(15) do |b| b.report('feedjira') do iterations.times do xmls.each { |xml| Feedjira::Feed.parse xml } end end b.report('simple-rss') do iterations.times do xmls.each { |xml| SimpleRSS.parse xml } end end b.report('feed-normalizer') do iterations.times do xmls.each { |xml| FeedNormalizer::FeedNormalizer.parse xml } end end # incompatible with `ruby-feedparser`, same constant used require 'feed_parser' b.report('feed_parser') do iterations.times do xmls.each { |xml| FeedParser.new(feed_xml: xml).parse } end end b.report('feed_me') do iterations.times do xmls.each { |xml| FeedMe.parse xml } end end # incompatible with `feed_parser`, same constant used # require 'feedparser' # b.report('ruby-feedparser') do # iterations.times do # xmls.each { |xml| FeedParser::Feed::new xml } # end # end end puts "\nFetch and parse benchmarks" Benchmark.bm(15) do |b| b.report('feedjira') do iterations.times { Feedjira::Feed.fetch_and_parse urls } end # incompatible with `ruby-feedparser`, same constant used require 'feed_parser' b.report('feed_parser') do iterations.times do urls.each { |url| FeedParser.new(url: url).parse } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
feedjira-1.1.0 | benchmarks/other_libraries.rb |
feedjira-1.0.0 | benchmarks/other_libraries.rb |
feedjira-0.9.0 | benchmarks/other_libraries.rb |