Userdefaults performance validation

I have tried to insert 1L key-values into the user defaults. It is working fine until 50k key-values. After some time, am getting

Not updating lastKnownShmemState in CFPrefsPlistSource<0x2825b0c60> (Domain: peformance_validator, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No)

also, key-values are not updating in the plist as well. peformance_validator is my user defaults group name.

How can I solve this ?

How can I solve this ?

Find some other way to store this data, e.g. in the filesystem.

UserDefaults is intended to store small preferences. I’m not sure why you’re trying to run performance analysis on it, but your test limits are far beyond the expected use case.

If you need to store 50 thousand records, or even 1 thousand records, user defaults is not the API to use. There are plenty of other options, including the file system, Core Data, and Swift Data.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

That still doesn't answer the question. I have a user defaults (preferences) file with few entries and when running tests I keep getting messages like "Not updating lastKnownShmemState in CFPrefsPlistSource<0x600000358360> (Domain: org.Home.MoviesDB, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): 1169 -> 1181"

Is there something wrong?

i started to get same log after installing xcode 16.1 beta even if am not using the command line tool of 16.1 but 16.0

Userdefaults performance validation
 
 
Q