Efficient XML loading [continuation of NSString from mapped NSData thread]
Efficient XML loading [continuation of NSString from mapped NSData thread]
- Subject: Efficient XML loading [continuation of NSString from mapped NSData thread]
- From: Keith Duncan <email@hidden>
- Date: Wed, 14 May 2008 15:52:55 +0100
Currently I'm loading the iTunes XML library using -[NSDictionary
initWithContentsOfFile:] but for my iTunes library, even a reasonably
small one, the file weighs in at just over 4 MB.
This causes a noticeable pause in my application because it has to
parse the entire file. I'm looking for an alternate method primarily
because it is loading all the song entries when all I need are the
playlists. Using the ScriptingBridge isn't possible because I don't
want to have to open iTunes just to get a list of playlists.
Based on the discussion of creating strings from the mapped data I
considered attempting to open the file, map it into an NSData
instance, scan through it to find the keys I need incrementally thus
avoiding having to load the whole file, then closing it. The only
problem however is that iTunes periodically replaces this file, if
this were to happen whilst I have the original mapped, would my app
crash? Essentially, whilst I have the file open, will it remain
readable?
Or is this approach potentially even more time consuming that simply
letting NSDictionary load the entire file into memory?
Keith
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden