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
:
Parsing feeds is as simple as this: