Some time ago I came across LastRSS, a PHP RSS parser which caught my attention because it looked a lot lighter (just one tiny file) than MagpieRSS, the big gun of its category. So I decided to give LastRSS a try and went for some quick tests and benchmarks.
Is LastRSS powerful ? fast ? easy to use ? And compared to MagpieRSS, is it more powerful ? faster ? easier ?
I wanted to test how fast MagpieRSS and LastRSS can :
– include the requested php code into a page (the require_once part)
– fetch a remote feed
– parse and output data
– save a cached feed
– fetch a cached feed
To do so, here is how I proceeded :
– I locally mirrored an example of a typical RSS feed (Slashdot's feed), to avoid my internet connexion latency
– I wrote this quick script : starts timer, begin loop, fetches the feed, caches if applicable, loop if applicable, stops timers, displays result.
– I went on testing using cache and not using it, fetching several times the same feed.
The fetching was done using the most simple and most default script configuration, with no fancy option.
Here are the raw results : number of seconds it took to each PHP parser to parse a given number of time a feed, using their own cache feature or not.
Line 1 shows the time needed to include code, fetch feed, parse data.
Line 2 shows the time needed to include code, fetch feed, parse data, fetch feed, parse data.
Line 5 shows the time needed to include code, fetch feed, parse data, write cached feed.
Line 6 shows the time needed to include code, fetch feed, parse data, write cached feed, fetch cached feed, parse data.
What we can see is that LastRSS is a lot faster than MagpieRSS to include code and to fetch a remote feed. They are about equally fast to fetch, write and parse a cached feed.
Differences between the 2 parsers
Let's not conclude too fast : LastRSS is much faster, but it does a lot less. Parsing a small fake feed (a la Slashdot RSS, containing just one item), here are the print_r results of data collected by the two parsers :
As you can see, MagpieRSS parses virtually anything in the feed, even custom <slash:stuff> items, while LastRSS focuses mainly on <title>, <link> and <description>
If you can afford it, there are no real reason you shouldn't use MagpieRSS. For the average user's needs, Magpie does a lot more than you really need, but it does all that you do need.
This said, there are situations you could consider using LastRSS as an effective alternative : for example, if you need extra fresh data (no cache), need to parse very often a loooot of feeds, have a weak server CPU wise, and need only data LastRSS collects (ie titles and links), it does look like a clever choice.
Conclusion of the conclusion
Ah. I always feel better when I write something serious on a completely futile subject :)
Want to share or tweet this post? Please use this short URL: http://ozh.in/3c