Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synchronize is deprecated and will be marked with the NS_DEPRECATED macro in a future release.(from Apple) #61

Closed
xueminlee opened this issue Sep 30, 2018 · 4 comments

Comments

@xueminlee
Copy link

This is a great frameworks to solve the key-value read/write problems, and has great performance comparing to NSUserDefaults and SQLite。It use the mmap, protobuf and some elegant strategies。

My question is your idea is base on the NSUserDefaults's poor performance is due to synchronize call, but from apple, synchronize will be deprecated and should be remove the synchronize call. (synchronize is deprecated and will be marked with the NS_DEPRECATED macro in a future release.)

@lingol
Copy link
Collaborator

lingol commented Sep 30, 2018

And what do they mean by deprecate this method? Does that mean NSUserDefaults will never lose data on App crashing? No? Well, here comes MMKV.

It's not about NSUserDefaults being slow, it's about keeping efficiency while not losing data.

@xueminlee
Copy link
Author

xueminlee commented Sep 30, 2018

Please refer:https://developer.apple.com/library/archive/releasenotes/Foundation/RN-FoundationOlderNotes/index.html#X10_10Notes

see section: -[NSUserDefaults synchronize] Changes

@lingol
Copy link
Collaborator

lingol commented Sep 30, 2018

Apple declared in iOS 10 release note that

Synchronized to avoid losing data if your app crashed

is not needed anymore. I personally highly doubt that.

Well, let's trust that statement. Try this: comment the synchronize in the baseline code and run again. You can find out that NSUserDefaults is not any faster. What does that tell you?

@xueminlee
Copy link
Author

xueminlee commented Sep 30, 2018

Thanks. I try to comment synchronize and also 10 times the test case to see the result, the result is very interesting.

I also wonder if need other test case, like read, write, read, write, ...., to simulator the real world access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants