Sunday, May 2, 2010

iPhone XML Performance Revisited

Ray Wenderlich has done a great comparison of iPhone XML parsers, using the same sample I had looked at earlier in the context of responsiveness.

 

As Ray was comparing performance, my hobby-horse, I was obviously curious as to how MAX stacked up against all the upstart competition. Quite well, as it turns out (average of 5 runs on an iPad with 3.2):


Figure 1: total times (seconds)


MAX was about 50% faster than the closest competition, TBXML, at 0.43s vs. 0.61s.

 

However, the XMLPerformance sample is a bit weird in that it measures elapsed time, not CPU time, and is multi-threaded, updating the display as results come in.

 

In order to account for this overhead that has nothing to do with the XML parsers, I added a "Dummy" parser that doesn't actually parse anything, but rather just generates dummy Song entries as quickly as possible. This takes around 0.2 seconds all by itself. Subtracting this non-XML overhead from the total times yields the following results:


Figure 2: XML parse times (seconds)


When measuring just the XML parsers themselves, MAX is around twice as fast as the closest competition and seven times as fast as the built in NSXMLParser.

 

Sweet.

[Update]  I forgot the link to where I had uploaded the source: XMLPerformance.tgz at http://www.metaobject.com/downloads/Objective-C/

4 comments:

Tuan Manh Cao said...

Very interesting and impressive comparision, Marcel. It would be very helpful if you can post the sample code of the benchmark.

Marcel Weiher said...

Link to code added. (code itself was uploaded with the article).

vvvv said...

Hi Marcel,

i have downloaded source code from given link but its not working i am getting errors when i build the source code.

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MPWMAXParser", referenced from:
objc-class-ref in MAXSongParser.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please provide the working code asap.

Thanks,
Pooja

pooja said...

Hi Marcel,

i have downloaded source code from given link but its not working i am getting errors when i build the source code.

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MPWMAXParser", referenced from:
objc-class-ref in MAXSongParser.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please provide the working code asap.

Thanks,
Pooja