Friedrich Ewald My Personal Website

Fast feed processing in Ruby and Rails

While working on my current project, everypodcast, I needed to implement an RSS feed parser, mostly for iTunes RSS feeds. Initially I went with the builtin RSS package from the standard library. When reading a lot of large XML feeds, I noticed that parsing those feeds takes anywhere from 0.5 to over 30 seconds. At the same time the process was using a 100% CPU. After some searching I found Feedjira. With this, it now takes on average 0.5 seconds and at most 1.5 seconds to parse even the longest feeds. Furthermore it has dedicated support for different types of RSS feeds, I highly recommend it. Installation via Gemfile:

gem 'feedjira', '~> 3.2'
Parsing feeds is as simple as this:
URI.parse(url).open(read_timeout: 10) do |rss|
    feed = Feedjira.parse(rss.read)
    # Feed attributes can be accessed as follows
    feed.language  #=> 'en'
end


About the author

is an experienced Software Engineer with a Master's degree in Computer Science. He started this website in late 2015, mostly as a digital business card. He is interested in Go, Python, Ruby, SQL- and NoSQL-databases, machine learning and AI and is experienced in building scalable, distributed systems and micro-services at multiple larger and smaller companies.