• yoav-steinberg's avatar
    dict struct memory optimizations (#9228) · 5e908a29
    yoav-steinberg authored
    Reduce dict struct memory overhead
    on 64bit dict size goes down from jemalloc's 96 byte bin to its 56 byte bin.
    
    summary of changes:
    - Remove `privdata` from callbacks and dict creation. (this affects many files, see "Interface change" below).
    - Meld `dictht` struct into the `dict` struct to eliminate struct padding. (this affects just dict.c and defrag.c)
    - Eliminate the `sizemask` field, can be calculated from size when needed.
    - Convert the `size` field into `size_exp` (exponent), utilizes one byte instead of 8.
    
    Interface change: pass dict pointer to dict type call back functions.
    This is instead of passing the removed privdata field. In the future if
    we'd like to have private data in the callbacks we can extract it from
    the dict type. We can extend dictType to include a custom dict struct
    allocator and use it to allocate more data at the end of the dict
    struct. This data can then be used to store private data later acccessed
    by the callbacks.
    5e908a29
t_zset.c 139 KB