• 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
Re: Efficient XML loading [continuation of NSString from mapped NSData thread]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficient XML loading [continuation of NSString from mapped NSData thread]


  • Subject: Re: Efficient XML loading [continuation of NSString from mapped NSData thread]
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 14 May 2008 08:04:05 -0700


On 14 May '08, at 7:52 AM, Keith Duncan wrote:

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.

I ran into the same issue. The bottleneck isn't the file I/O, it's the tens of thousands of objects (strings, dictionaries, arrays) created by parsing the property list.


I was able to speed this up by an order of magnitude, by using libxml2 to parse the file (using the SAX API) into my own custom data structures.

I am nearly always cheerfully willing to give out source code, but in this case I kind of see this as a competitive advantage for a product I might release in the future, so I'm going to keep the code to myself. It isn't brain surgery, or even rocket science, but it took some work; libxml2 is a lot lower-level than the plist API. (I didn't try using NSXMLParser, which is an Obj-C wrapper around libxml2; that might get you comparable performance with less pain.)

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: "Louis Gerbarg" <email@hidden>
    • Re: Efficient XML loading [continuation of NSString from mapped NSData thread]
      • From: Keith Duncan <email@hidden>
References: 
 >Efficient XML loading [continuation of NSString from mapped NSData thread] (From: Keith Duncan <email@hidden>)

  • Prev by Date: Re: how to update the view of NSPrintOperation ?
  • Next by Date: Re: Create NSStrings from a mapped NSData object - safe?
  • Previous by thread: Efficient XML loading [continuation of NSString from mapped NSData thread]
  • Next by thread: Re: Efficient XML loading [continuation of NSString from mapped NSData thread]
  • Index(es):
    • Date
    • Thread