On 10 Dec 2013, at 6:08 pm, Kyle Sluder <k...@ksluder.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to