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 ?
Testing
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.
Raw results
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 :
– LastRSS
– MagpieRSS
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>
Conclusion
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 :)
Shorter URL
Want to share or tweet this post? Please use this short URL: http://ozh.in/3c
I use Magpie and i'm satisfied with it, it does what you want right and clear.
Moreover, you've forgotten to mention that Magpie can parse Atom feeds. I haven't tried this feature yet, but obviously lastRSS can't do so …
[…] are no real reason you shouldn't use MagpieRSS. For the average user's needs, Magpie does a lot more than you really need, […]
hey ozh,
the link to your benchmarking code seems to be broken.
i thought i'd grab it and test a new version of magpie i'm going to be releasing this evening. (though i think its going to get slower not faster, as it attempts to be smart about encoding issues)
Fixed. But be warned, this is a *very* simple script :)
i'm currently using magpierss… some times it returns bad characters… then i tryied (didnt aplied yet) lastRSS and no bad characters or CDATA tags on the link ref
i'm using carp but the " ' " (apostrohpe ) are translated by ?
does someone know how parse a rss 2.00 in french language ?
There some bad code above, that I have just attemped to close off, but it would be better if it was fixed.
Anyway, MagpieRSS is great if you want to use it in the standard way, but there are few comments so
understanding it is a bitch if you need to modify it in order to get it working the way you need it to. I would
love it so much better if it was commented.
Thanks for doing these tests! I was curious about the differences between these two scripts.
On a side note… I normally use Firefox, but when I was trying to comment here, I found that as soon as I placed my cursor in the Name field, the page would reload. Here I am posting in IE then, and commenting works without a hitch (but I feel so dirty using IE!)
cheers
SAM :)
Thanx for the information. Btw is there any other rss parser script like magpie? Can u tell me?
Jokerz » these days SimplePie seems to be much more attractive than MagpieRSS. Other than that, LastRSS is the only decent alternative I know of.
Tks for the info, it was just what I was looking for.
Great comparison, thanks for it. Here is a link to a SimplePie MagpieRSS comparison: http://codeninja.de/simplepie_vs_magpie/
Reading all these tests I decided to use mapierss
[…] discards, say, the dc:date field in my del.icio.us feed. Magpie doesn't eat up elements, but it's slower, uses Snoopy instead of cURL, and contains switches specific to various RSS versions and […]
Happily using LastRSS :)
thanks for info and great comparison results ;)
Would somebody be kind enough to either point me to a site or give me some instructions on how to use LastRSS please ? I tried but couldn't get it to work. Is there a little tutorial on it anywhere ? Thanks.
I'm currently using LastRSS and see its limitations when it fails to retrieve custom tags. However it's lightweight and easy to hack. I use it because it's so easy to load as a library with CodeIgniter. Simplepie can also be loaded with CI but that's much too slow for my needs.
Still getting to grips with lastRSS and as previous entry says – it's easy to hack.
Big problem I have, I'm using lastRSS to pick up and display traffic feeds that really should be updating every 5 mins or so. Trouble is, lastRSS seems to have stop calling for the latest traffic RSS. Have changed all settings back to original but no auto refresh. Also in the call 'new rssticker_ajax', doc declares that cachetime is in minutes. You say it is in secs. Please can U help. Cheers
Mark » Sorry, I'm not doing any kind of support for this, I'm just an innocent user just like you :)
Understood, just wondered if anybody has had the same problem.
[…] MagpieRSS vs LastRSS : comparison of PHP RSS parsers « planetOzh Perbandingan dua jenis pustaka pemrograman PHP (tags: pustaka php rss) […]
can i use LastRSS on my blogspot? just place source code on add element? help me please! email me!
Fatic » Of course you cant. You can't do shit with blogspot. Get real hosting.
[…] from Planetozh addthis_url = […]
[…] veya daha iyisi var m? diye bak?n?rken MagpieRss ile lastRss'in kar??la?t?r?ld??? bir makale buldum, incelemeye […]
[…] (i test sono stati effettuatu da: planetozh.com) […]