• Binbin's avatar
    Minor optimization in kvstoreDictAddRaw when dict exists (#13054) · c8548737
    Binbin authored
    Usually, the probability that a dict exists is much greater than the
    probability that it does not exist. In kvstoreDictAddRaw, we will call
    kvstoreGetDict multiple times. Based on this assumption, we change
    createDictIfNeeded to something like get or create function:
    ```
    before:
    dict exist: 2 kvstoreGetDict
    dict non-exist: 2 kvstoreGetDict
    
    after:
    dict exist: 1 kvstoreGetDict
    dict non-exist: 3 kvstoreGetDict
    ```
    
    A possible 3% performance improvement was observed:
    
    In addition, some typos/comments i saw have been cleaned up.
    c8548737
kvstore.h 3.59 KB