• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Efficient XML loading [continuation of NSString from mapped NSData thread]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Efficient XML loading [continuation of NSString from mapped NSData thread]
      • From: Matt Gough <email@hidden>
    • Re: Efficient XML loading [continuation of NSString from mapped NSData thread]
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Cocoa and Carbon
  • Next by Date: Re: how to update the view of NSPrintOperation ?
  • Previous by thread: Programmatically Set Image Capture Prefs
  • Next by thread: Re: Efficient XML loading [continuation of NSString from mapped NSData thread]
  • Index(es):
    • Date
    • Thread