• 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: Preferences caching?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preferences caching?


  • Subject: Re: Preferences caching?
  • From: Graham Cox <email@hidden>
  • Date: Tue, 10 Dec 2013 20:13:27 +0100

On 10 Dec 2013, at 6:08 pm, Kyle Sluder <email@hidden> wrote:

> Bingo. You are now caught up with the original post in this thread.
>
> The plist files are and always have been an implementation detail. The only supported interface to preferences has always been through CFPreferences/NSUserDefaults, whether via code or the defaults command line tool.


Kind of tangential to the topic of the thread, but something I also observed this week while focusing on performance, but NSUserDefaults is the not quite the lightweight API it appears.

I’ve long assumed that basically it’s an interface to a locally cached dictionary, with periodic synchronization to disc (or whatever the underlying implementation happens to be these days), BUT if you hit it a lot, as I was doing to examine a persistent bool for almost every drawing operation, you’ll find that it burrows deep down not only to CFPreferences but further into a longish search through lower levels of the preferences system, on every single call. This ended up accounting for about 8% of my drawing time (I know, percentages don’t tell you much, except which areas are relatively worth optimizing). So caching that one bool locally was a worthwhile benefit.

Just something to bear in mind if you tend to assume NSUserDefaults has next to no cost.

—Graham


_______________________________________________

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


References: 
 >Re: Preferences caching? (From: Jens Alfke <email@hidden>)
 >Re: Preferences caching? (From: Jakob Egger <email@hidden>)
 >Re: Preferences caching? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Preferences caching?
  • Next by Date: NSURLSessionUploadTask - stops uploading after sending 160kB of data (5x 32kB chunks)
  • Previous by thread: Re: Preferences caching?
  • Next by thread: Re: Preferences caching?
  • Index(es):
    • Date
    • Thread