Re: Performance issue : NSDictionary against NSXMLNode and NSXMLParser
Re: Performance issue : NSDictionary against NSXMLNode and NSXMLParser
- Subject: Re: Performance issue : NSDictionary against NSXMLNode and NSXMLParser
- From: Chris Kane <email@hidden>
- Date: Fri, 17 Jun 2005 11:35:10 -0700
On Jun 17, 2005, at 1:34 AM, Yann Bizeul wrote:
I'm writing an application that used to take its data from a
file using plist syntax, so that it is loadable with
dictionaryWithContentsOfFile:.
This was very efficient, quick to load and parse.
Then we decided to change the file format, and use a custom XML
DTD, that's where the problems began.
First, I decided to use NSXMLNode with its powerfull XQuery
implementation, things were really fine, and I was really impressed
by the power of XQuery.... with 10 entries.
But when testing with a big file consisting of more that 5000
entries, it took more that 10s to load, and filtering was a pain.
So according to the doc, I saw that NSXMLParser should be more
efficient, which is true, file takes only 6s to parse and filtering
should be quicker too
But I would like to know how I could get the same performance
of NSDictionnary loading its content from a file. If anyone has a
good tip to quickly load, parse and filter big XML files please
advice :-)
Write a custom parser for the particular XML file structure you are
using, hard-coding in the knowledge of the file structure and what
elements come where.
NSDictionary and related things that deal with Property Lists use a
custom parser for XML-style property lists. All that it can parse is
Property List files, and it can barely do that. ;-) It has many
little optimizations all over that know about Property List structure.
NSXMLParser and NSXMLDocument/Node are built atop the libxml2 open
source XML parser (NSXMLParser being a pretty thin wrapper). A
general XML parser has a lot of XML features do support (and look for
in the input stream), many of which you may not be using.
Chris Kane
Cocoa Frameworks, Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden