Better performance with libxml2 or NSXMLParser on the iPhone?

前端 未结 8 2001
天涯浪人
天涯浪人 2020-12-02 23:40

I\'m curious what your solution is for high performance XML parsing on the iPhone is, given its limited amount of CPU power. I have reviewed the XML Performance App that App

8条回答
  •  青春惊慌失措
    2020-12-03 00:10

    libxml2 is always going to be faster than NSXMLParser. NSXMLParser gives you a decent event-bsaed API, but it's built on top of libxml2 and it also isn't stream-based (e.g. NSXMLParser hands the entire block of data to libxml2 at once).

    If you're optimizing for speed, libxml2 is definitely the way to go. However if you want an obj-c event-based API and don't care so much about performance, NSXMLParser is the right tool for the job. And please note that NSXMLParser isn't necessarily slow, it's just not as fast as libxml2.

提交回复
热议问题