Giter Club home page Giter Club logo

Comments (10)

lingol avatar lingol commented on May 22, 2024

Mainly because NSDictionary's value type is uncertain, it's hard to encode/decode NSDictionary properly in protobuf, if not possible.

However, you can turn a NSDictionary into a NSData by NSArchive, and store that NSData in MMKV.

from mmkv.

MichaelJokAr avatar MichaelJokAr commented on May 22, 2024

+1

from mmkv.

yuman07 avatar yuman07 commented on May 22, 2024

NSUserDefault can read/write NSDictionary directly, and MMKV needs to do a conversion through NSArchive. If you consider the consumption of conversion, is the performance advantage of MMKV still greater than NSUserDefault?

from mmkv.

lingol avatar lingol commented on May 22, 2024

NSUserDefault can read/write NSDictionary directly, and MMKV needs to do a conversion through NSArchive. If you consider the consumption of conversion, is the performance advantage of MMKV still greater than NSUserDefault?

Well, NSUserDefault's NSDictionary support doesn't come in free. Which algorithm do you think it used to store NSDictionary? NSArchive? I haven't test it yet, but that's my best guess.

Given that guess, I have confidence MMKV will beat NSUserDefault in such case.

from mmkv.

yuman07 avatar yuman07 commented on May 22, 2024

thx~

from mmkv.

wg689 avatar wg689 commented on May 22, 2024

you tell me I should better convert dictionary or Nsarray to NSData ,not the jsonStr , the reason is ( value type is uncertain, it's hard to encode/decode NSDictionary properly)? when I conert to jsonStr , all is NSString ,
or have other reason ?

from mmkv.

lingol avatar lingol commented on May 22, 2024

you tell me I should better convert dictionary or Nsarray to NSData ,not the jsonStr , the reason is ( value type is uncertain, it's hard to encode/decode NSDictionary properly)? when I conert to jsonStr , all is NSString ,
or have other reason ?

Use NSData for efficiency, or JSON for convenience. It's your choice.

from mmkv.

Damonvvong avatar Damonvvong commented on May 22, 2024

其实可以提供一个直接存 NSDictionary 的 api。然后内部进行一步转换~你觉得呢?

@lingol

from mmkv.

lingol avatar lingol commented on May 22, 2024

其实可以提供一个直接存 NSDictionary 的 api。然后内部进行一步转换~你觉得呢?

@lingol

Maybe.

from mmkv.

lingol avatar lingol commented on May 22, 2024

Supported with #78 , checkout release note.

from mmkv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.