Are there any performance or other consequences for setting an object for key in the NSUserDefaults repeatedly?
[self.myDefaults setObject:someObject forKey:someKey];
and/or
anObject = [self.myDefaults objectForKey:someKey];
My loop will repeat approx 100 times within a second, and only last for a few seconds at a time.
I’ll only be calling synchronize after the loop is finished.
The NSUserDefaults docs state:
“NSUserDefaults caches the information to avoid having to open the user’s defaults database each time you need a default value.”
Therefore it’s no different to setting or getting an object from an in-memory dictionary variable.
However, calling
[self.myDefault synchronize];within a type loop would have a performance consequence, as this opens and writes to the defaults database on disk.