Is read access for NSUserDefaults an “expensive” operation?

The title pretty much sums it up when reading the data stored in NSUserDefaults for the iphone application, are there any performance considerations that need to be made?

Is there something I’m missing or reading from NSUserDefaults trivially, and can it abuse the desire of the developer?

+4
source share
1 answer

At run time, you use the NSUserDefaults object to read the default values ​​that your application uses the default database for users. NSUserDefaults caches information to not open the default database user settings every time you need a default value. The synchronization method, which is automatically called at periodic intervals, in-cache memory in synchronization with the default database for users.

As far as the documentation says, it's safe enough to use it if you call synchronize too often. You can read more about this here .

+9
source

Source: https://habr.com/ru/post/1384631/


All Articles