Guest Post: NetNewsWire iPhone Code Surprise
[Editor's Note: The following is a guest post by NewsGator's Brent Simmons.]
When I first started working on the iPhone version of NetNewsWire last spring, I expected to be able to use code from the Mac version. After all, Macs and iPhones are very similar.
But it turned out that I used almost no code from the Mac version in the iPhone version. And the code I did use had to be modified.
What I didn't expect was that the reverse would happen, that I would end up bringing iPhone code back to the Mac version, but that's what happened. Here's the story...
One of the first things I noticed when I started working on NetNewsWire for iPhone was that I couldn't use the XML parser that I used in the Mac version. It doesn't exist on the iPhone.
So I had to look at the XML parsers that do exist on the iPhone, and, after doing some research, I finally settled on libxml2. I built a new RSS parser using libxml2, and I was very pleased with the performance on iPhone. All was well.
But then I got curious and I wondered how this new RSS parser would compare to the old one in the Mac version.
I brought the new code into the Mac version and did some tests. It turned out that the new version was more than four times faster than the old version -- and it used one-third the memory.
(You can now pause to imagine my diabolical laughter.)
It's not every day a developer has an experience like this. Usually you get to choose just one: faster, or uses less memory -- but not both. But this time? Both.
The new fast RSS parser will appear in NetNewsWire 3.2, which I'm working on now. An early version is in the hands of beta testers, but there's still some other work to do. (A few new features, a bunch of bug fixes.)
Now, of course, RSS parser performance isn't the whole story of performance: there's data storage and networking and a bunch of other things. But, still, I'm delighted. I just love that the iPhone is helping out the Mac version -- and I can hardly wait to get it finished and released.


